Issue Details (XML | Word | Printable)

Key: MODPYTHON-175
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

PSP error page accessing session object can cause a deadlock.

Created: 27/Jun/06 06:03 PM   Updated: 17/Apr/07 10:59 AM
Return to search
Component/s: None
Affects Version/s: 3.2.8
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

Resolution Date: 29/Jul/06 12:23 PM


 Description  « Hide
If a session object is required for a PSP page, the session object will be created automatically with the session being locked at the same time, when PSP.run() is called. If an error page is generated by the session page it in turn will then be run. The problem is that the session lock is still held by the main page and thus if the error page itself tries to also access the session object, when the PSP.run() method of the error page is called, it will create a new instance of the session object which will result in a deadlock.

In MODPYTHON-38, the suggested change was that when PSP.run() creates the session object that it assign it back to req.session. This change was not made, but if it was then when the error page was run, it would simply have inherited the session object which had already been created by the main page and a deadlock would not have ensued.

Thus could should read as:

        session = None
        if "session" in code.co_names:
            if hasattr(req, 'session'):
                session = req.session
            else:
                req.session = session = Session.Session(req)


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Graham Dumpleton made changes - 29/Jul/06 11:20 AM
Field Original Value New Value
Assignee Graham Dumpleton [ grahamd ]
Graham Dumpleton made changes - 29/Jul/06 11:20 AM
Status Open [ 1 ] In Progress [ 3 ]
Graham Dumpleton made changes - 29/Jul/06 12:23 PM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Fix Version/s 3.3 [ 12310101 ]
Repository Revision Date User Message
ASF #426788 Sat Jul 29 12:25:06 UTC 2006 grahamd (MODPYTHON-175) Fixed problem whereby a main PSP page and an error page
triggered from that page both accessing the session object would cause a
deadlock.

(MODPYTHON-176) Fixed issue whereby PSP code would unlock session object
which it had inherited from the caller meaning caller could no longer use
it safely. PSP code will now only unlock session if it created it in the
first place.
Files Changed
ADD /httpd/mod_python/trunk/test/htdocs/psptest_main.psp
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/psp.py
ADD /httpd/mod_python/trunk/test/htdocs/psptest_fail.psp
MODIFY /httpd/mod_python/trunk/test/test.py
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex

Graham Dumpleton made changes - 17/Apr/07 10:59 AM
Status Resolved [ 5 ] Closed [ 6 ]