Can't use bzrlib inside a django app

Bug #538937 reported by Ian Clatworthy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
Unassigned

Bug Description

Importing anything inside bzrlib ends up implicitly calling osutils.register_sigwinch() which breaks Django. Here's the end of the exception:

  2156. class BzrDirFormat4(BzrDirFormat):
File "/usr/lib/python2.6/dist-packages/bzrlib/bzrdir.py" in BzrDirFormat4
  2169. _lock_class = lockable_files.TransportLock
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in __getattribute__
  106. obj = _replace()
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in _replace
  89. obj = factory(self, scope, name)
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in _import
  192. module = __import__(module_python_path, scope, scope, [member])
File "/usr/lib/python2.6/dist-packages/bzrlib/lockable_files.py" in <module>
  64. class LockableFiles(object):
File "/usr/lib/python2.6/dist-packages/bzrlib/lockable_files.py" in LockableFiles
  223. @only_raises(errors.LockNotHeld, errors.LockBroken)
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in __getattribute__
  106. obj = _replace()
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in _replace
  89. obj = factory(self, scope, name)
File "/usr/lib/python2.6/dist-packages/bzrlib/lazy_import.py" in _import
  192. module = __import__(module_python_path, scope, scope, [member])
File "/usr/lib/python2.6/dist-packages/bzrlib/errors.py" in <module>
  20. from bzrlib import (
File "/usr/lib/python2.6/dist-packages/bzrlib/osutils.py" in <module>
  1446. signal.signal(signal.SIGWINCH, _terminal_size_changed)

Exception Type: ValueError at /bzr-alldocs_/
Exception Value: signal only works in main thread

This is rather bad.

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 538937] [NEW] Can't use bzrlib inside a django app

On Mon, 2010-03-15 at 06:27 +0000, Ian Clatworthy wrote:
> Public bug reported:
>
> Importing anything inside bzrlib ends up implicitly calling
> osutils.register_sigwinch() which breaks Django. Here's the end of the
> exception:
> ...File "/usr/lib/python2.6/dist-packages/bzrlib/osutils.py" in <module>
> 1446. signal.signal(signal.SIGWINCH, _terminal_size_changed)
>
> Exception Type: ValueError at /bzr-alldocs_/
> Exception Value: signal only works in main thread
>
> This is rather bad.

They should be able to 'work around' this trivially by importing
bzrlib.osutils in their main thread. Its a bit of a python bug that you
can't use signal from any thread, really.

That said, I think this has changed in trunk anyway, so that you have to
create a CLI UI for it to hook now.

-Rob

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.