errors when importing WorkingTree on a thread due to signals
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
Martin Pool | ||
2.1 |
Fix Released
|
High
|
Martin Pool | ||
Ubuntu One Servers |
Fix Released
|
Low
|
Elliot Murphy | ||
bzr (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
I have some python code that runs inside the paste threaded wsgi server. It imports WorkingTree just to figure out some simple things like the root of the tree. When running with 2.1.0~rc2-1, I started getting errors:
12. from bzrlib.workingtree import WorkingTree
File "/usr/lib/
86. from bzrlib.
File "/usr/lib/
64. class LockableFiles(
File "/usr/lib/
223. @only_raises(
File "/usr/lib/
106. obj = _replace()
File "/usr/lib/
89. obj = factory(self, scope, name)
File "/usr/lib/
192. module = __import_
File "/usr/lib/
20. from bzrlib import (
File "/usr/lib/
1446. signal.
Exception Type: ValueError at /
Exception Value: signal only works in main thread
This seems to be due to bzrlib/osutils.py now making use of signal.signal. I can probably work around this in my code so that I no longer import WorkingTree, but it seems like this could also cause a problem for systems like loggerhead, so I thought I would go ahead and report the bug. I don't know how the bzr code is factored, if it indeed is supposed to be possible to use WorkingTree inside python threads maybe there is a UI layer that this signal code could be moved to.
Related branches
- Martin Pool: Approve
- Robert Collins (community): Approve
-
Diff: 55 lines (+20/-7)2 files modifiedbzrlib/osutils.py (+15/-6)
bzrlib/ui/text.py (+5/-1)
Changed in ubuntuone-servers: | |
assignee: | nobody → Elliot Murphy (statik) |
importance: | Undecided → Low |
Changed in bzr: | |
importance: | Medium → High |
assignee: | nobody → Martin Pool (mbp) |
Changed in ubuntuone-servers: | |
status: | Fix Committed → Fix Released |
We shouldn't be doing this unconditionally or at load time, only (probably) when a TextUIFactory is constructed.