Hi, I have a bug and fix to submit. Attached is a patch file for
WebKit/SessionStore.py against the 0.9 release.
The SessionStore convenience functions items() and values() include a
bug where a session key can be deleted after self.keys() has been
called, but before the session has been accessed from the store. This
leads to an unhandled KeyError which causes SessionSweeper to fail,
allowing sessions to pile up until catastrophic failure due to lack of
memory.
When using the SessionMemoryStore, this bug is extraordinarily rare. I
only encountered it with a high-traffic site where we use
SessionDynamicStore, and every Monday (the site's highest traffic day)
the appserver would consume all memory ending up with about 75,000
sessions, and I would find traces of this error in the logs (way back in
the logs). After applying the fix a few weeks ago, the app has been fine
ever since.
Please let me know if I should submit this another way. I wasnt sure if
the bug tracking at SourceForge is still in use.
Thanks! - Ben
--- SessionStore.py.orig Sun Apr 2 20:52:17 2006
+++ SessionStore.py Sun Apr 2 20:55:55 2006
@@ -124,10 +124,23 @@
## Convenience methods ##
def items(self):
- return map(lambda key, self=self: (key, self[key]), self.keys())
+ itms = []
+ for k in self.keys():
+ try:
+ itms.append((k, self[k]))
+ except KeyError:
+ pass
+ return itms
def values(self):
- return map(lambda key, self=self: self[key], self.keys())
+ vals = []
+ for k in self.keys():
+ try:
+ vals.append(self[k])
+ except KeyError:
+ pass
+ return vals
+
def get(self, key, default=None):
if self.has_key(key):