Commits

Anonymous committed b8bc930

Catch case where clean_up is called by 2 concurrent threads

  • Participants
  • Parent commits 800068b

Comments (0)

Files changed (1)

File cherrypy/filters/sessionfilter.py

             if expirationTime < now:
                 toBeDeleted.append(id)
         for id in toBeDeleted:
-            sess.onDeleteSession(cherrypy._session_data_holder[id])
-            del cherrypy._session_data_holder[id]
+            try:
+                del cherrypy._session_data_holder[id]
+                sess.onDeleteSession(cherrypy._session_data_holder[id])
+            except KeyError:
+                # The session probably got deleted by a concurrent thread
+                #   Safe to ignore this case
+                pass
 
 
 class FileStorage: