Skip to content

Commit 994803e

Browse files
authored
Merge pull request cherrypy#1787 from suheb/bugfix/1779
Do not remove session lock files
2 parents b68087d + 1a6f0ec commit 994803e

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

CHANGES.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
v18.2.0dev
2-
----------
1+
v18.2.0
2+
-------
3+
4+
* File-based sessions no longer attempt to remove the lock files
5+
when releasing locks, instead deferring to the default behavior
6+
of zc.lockfile. Fixes :issue:`1391` and :issue:`1779`.
37

48
* :pr:`1794`: Add native support for ``308 Permanent Redirect``
59
usable via ``raise cherrypy.HTTPRedirect('/new_uri', 308)``.

cherrypy/lib/sessions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
import threading
108108
import binascii
109109
import pickle
110-
import contextlib
111110

112111
import zc.lockfile
113112

@@ -566,8 +565,6 @@ def acquire_lock(self, path=None):
566565
def release_lock(self, path=None):
567566
"""Release the lock on the currently-loaded session data."""
568567
self.lock.close()
569-
with contextlib.suppress(FileNotFoundError):
570-
os.remove(self.lock._path)
571568
self.locked = False
572569

573570
def clean_up(self):

cherrypy/test/test_session.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def f():
222222
return [
223223
x
224224
for x in os.listdir(localDir)
225-
if x.startswith('session-')
225+
if x.startswith('session-') and not x.endswith('.lock')
226226
]
227227
assert f() == []
228228

@@ -236,7 +236,6 @@ def test_1_Ram_Concurrency(self):
236236
self.getPage('/set_session_cls/cherrypy.lib.sessions.RamSession')
237237
self._test_Concurrency()
238238

239-
@pytest.mark.xfail(reason='#1306')
240239
def test_2_File_Concurrency(self):
241240
self.getPage('/set_session_cls/cherrypy.lib.sessions.FileSession')
242241
self._test_Concurrency()

0 commit comments

Comments
 (0)