Opened 16 years ago

Closed 13 years ago

Last modified 11 years ago

#364 closed defect (fixed)

Use the "full" Python thread API

Reported by: Olly Betts Owned by: Olly Betts
Priority: normal Milestone: 1.3.0
Component: Xapian-bindings (Python) Version: SVN trunk
Severity: normal Keywords:
Cc: dnsauve@…, alex@… Blocked By:
Blocking: Operating System: All

Description

This bug is essentially "son of #185".

Most of the issues in that ticket are fixed, but the requirement to run Xapian-using code in the main interpreter when using mod_python or mod_wsgi remains.

Mark Hammond gives a good summary of what needs doing for this in comment:ticket:185:3 - essentially we would need to use the full Python thread API and keep a reference to "our" Python interpreter in thread local storage.

I think doing this won't require modifications to SWIG (though perhaps we should ultimately offer a patch to SWIG to provide this as an option) - you can override what SWIG uses in the blocking/allowing thread begin/end boilerplate, so I think someone "just" needs to write suitable replacements which store the interpreter in thread local storage which we can plug in to our interface files.

Attachments (2)

python-multiinterpreter-locking.patch (3.2 KB ) - added by Olly Betts 13 years ago.
Patch to implement locking using the "full" thread API
python.i-diff-against-reformatted-original.patch (1.6 KB ) - added by Olly Betts 13 years ago.
patch against reformatted original to show actual changes better

Download all attachments as: .zip

Change History (11)

comment:1 by David Sauve, 15 years ago

Cc: dnsauve@… added

comment:2 by Olly Betts, 15 years ago

Resolution: fixed
Status: closedreopened

Fixing status - was closed by spammer.

comment:3 by Alexander Clausen, 15 years ago

Cc: alex@… added

comment:4 by Olly Betts, 14 years ago

Component: Xapian-bindingsXapian-bindings (Python)

comment:5 by Olly Betts, 14 years ago

Milestone: 1.2.x
Version: 1.1.0SVN trunk

This should cause any incompatibilities for existing code using the Python bindings, so marking as suitable for 1.2.x.

by Olly Betts, 13 years ago

Patch to implement locking using the "full" thread API

comment:6 by Olly Betts, 13 years ago

Milestone: 1.2.x1.3.0

This patch against current trunk works for the single interpreter case - I've not tested it in the multiple interpreter case yet, but I think it's at least along the right lines.

The patch also tweaks pythontest2.py to use threads so that the thread locking actually does something.

Marking for 1.3.0 - assuming this patch (or something like it) works, fixing this in 1.3.0 should give us plenty of time to shake out any problems.

by Olly Betts, 13 years ago

patch against reformatted original to show actual changes better

comment:7 by Olly Betts, 13 years ago

Resolution: fixed
Status: reopenedclosed

Applied to trunk with some additional changes in r16201.

comment:8 by julefrokost, 12 years ago

I have tested this and it works ok for multiple interpreter case also.

Kind regards.

julefrokost.


milestone changed from 1.2.x to 1.3.0 This patch against current trunk works for the single interpreter case - I've not tested it in the multiple interpreter case yet, but I think it's at least along the right lines.


This patch against current trunk works for the single interpreter case - I've not tested it in the multiple interpreter case yet, but I think it's at least along the right lines. julefrokost

The patch also tweaks pythontest2.py to use threads so that the thread locking actually does something.

comment:9 by Olly Betts, 12 years ago

julefrokost: This patch has already been included on trunk and in the 1.3.0 development release - are you just providing additional testing info, or are you suggesting these changes should get backported to 1.2.x? If so, which Xapian version did you test with and what tests did you do?

Note: See TracTickets for help on using tickets.