- From: Jens Meggers <jens.meggers@firepad.com>
- Date: Wed, 28 Feb 2001 11:05:58 -0800
- To: "'www-lib@w3.org'" <www-lib@w3.org>
Hi, I applied the patch to my source base. It fixes a lot of problems apprearing under high load when processing requests loaded from a file (HTFile.c) mixed up with requests loading from the network (HTTCP.c). As the HTCache is using such kind of system, it also make the cache reliable. Thanks for finding the bug, Jens -----Original Message----- From: Stefan Wiesner [mailto:sw@ais-ag.de] Sent: Montag, 26. Februar 2001 06:11 To: www-lib@w3.org Subject: Bug in HTTimer.c Hi, I think there is a bug in the code of function HTTimer_new if a timer is already expired when HTTimer_new is called. See description below: >>> ... >>> /* >>> ** Sort new element into list >>> */ >>> for (cur = last; >>> (pres = (HTTimer *) HTList_nextObject(cur)) != NULL && pres->expires < expires; >>> last = cur); last cur | | | | V | -------- | |object|--->timer1 V | | -------- |next |---------------->|object|--->timer2 -------- | | |next |--->... -------- >>> ... >>> /* >>> ** add to list if timer is new >>> */ >>> HTList_addObject(last, (void *)timer); last cur | | | | V | -------- | |object|--->timer1 | | | -------- | |next |---------------->|object|--->timer_new V -------- | | -------- |next |----------------->|object|--->timer2 -------- | | |next |--->... -------- >>> ... >>> /* Check if the timer object has already expired. If so then dispatch */ >>> if (timer->expires <= now) Timer_dispatch(cur, last); >>> ... If the 'if' evaluates to 'TRUE', function 'Timer_dispatch' is called with wrong parameters. As the result, the HTList object pointing to timer_new gets lost and the callback function of timer2 is called. To fix this, the previous call of function 'HTList_addObject(last, (void *)timer);' should be replaced by 'cur = HTList_addList(last, (void *)timer);' One other thing to the Timer handling: Although it is a good idea to dispatch the timer in function 'HTTimer_new' when it has already expired, (I think) there is no way to get this information from the parameter the function returns. This behaviour may lead to errors in a calling program. (In fact it has in my program.) Greetings Stefan Wiesner -- Stefan Wiesner AIS Automations- und Informationssysteme GmbH Rheinweg 7, 34131 Kassel, Germany Telefon: +49-561/30859-24, Telefax: +49-561/30859-39
Received on Wednesday, 28 February 2001 14:15:54 UTC