Test failure: IllegalUseOfScopeReplacer: ScopeReplacer object 'ui' was used incorrectly

Bug #593536 reported by Vincent Ladeuil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Undecided
Unassigned
bzr (Ubuntu)
Fix Released
Undecided
Jelmer Vernooij

Bug Description

From http://babune.ladeuil.net:24842/job/selftest-freebsd/lastFailedBuild/testReport/junit/bzrlib.tests.blackbox.test_branch/TestBranchStacked/test_branch_stacked_from_smart_server/

_StringException: Text attachment: log
------------
28.771 opening working tree '/tmp/testbzr-SLAY4t.tmp'
------------
Text attachment: traceback
------------
Traceback (most recent call last):
  File "/home/babune/lib/python/testtools/runtest.py", line 144, in _run_user
    return fn(*args)
  File "/home/babune/lib/python/testtools/testcase.py", line 413, in _run_test_method
    testMethod()
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/tests/blackbox/test_branch.py", line 343, in test_branch_stacked_from_smart_server
    trunk = self.make_branch('mainline', format='1.9')
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/tests/__init__.py", line 2380, in make_branch
    repo = self.make_repository(relpath, format=format)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/tests/__init__.py", line 2408, in make_repository
    made_control = self.make_bzrdir(relpath, format=format)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/tests/__init__.py", line 2390, in make_bzrdir
    t.ensure_base()
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/transport/__init__.py", line 366, in ensure_base
    self.mkdir('.')
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/transport/remote.py", line 242, in mkdir
    self._serialise_optional_mode(mode))
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/transport/remote.py", line 182, in _call2
    return self._client.call(method, *args)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/client.py", line 132, in call
    result, protocol = self.call_expecting_body(method, *args)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/client.py", line 145, in call_expecting_body
    method, args, expect_response_body=True)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/client.py", line 90, in _call_and_read_response
    readv_body=readv_body, body_stream=body_stream)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/client.py", line 63, in _send_request
    encoder.call(method, *args)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/protocol.py", line 1308, in call
    self._write_end()
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/protocol.py", line 1133, in _write_end
    self.flush()
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/protocol.py", line 1099, in flush
    self._real_write_func(''.join(self._buf))
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/medium.py", line 396, in accept_bytes
    self._accept_bytes(bytes)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/medium.py", line 933, in _accept_bytes
    self._medium._accept_bytes(bytes)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/medium.py", line 849, in _accept_bytes
    osutils.send_all(self._socket, bytes, self._report_activity)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/osutils.py", line 2044, in send_all
    report_activity(sent, 'write')
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/smart/medium.py", line 176, in _report_activity
    ui.ui_factory.report_transport_activity(self, bytes, direction)
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/lazy_import.py", line 106, in __getattribute__
    obj = _replace()
  File "/usr/home/babune/babune/slaves/freebsd8.local/workspace/selftest-freebsd/bzrlib/lazy_import.py", line 88, in _replace
    extra=e)
IllegalUseOfScopeReplacer: ScopeReplacer object 'ui' was used incorrectly: Object already cleaned up, did you assign it to another variable?: _factory
------------

Probaly a nasty side effect of lazy import and threads or just lazy import and some weak test isolation (--parall=fork was used there and the test suite can be sliced differently at each new commit).

Tags: babune

Related branches

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 593536] [NEW] Test failure: IllegalUseOfScopeReplacer: ScopeReplacer object 'ui' was used incorrectly

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Public bug reported:
>
>>From http://babune.ladeuil.net:24842/job/selftest-
> freebsd/lastFailedBuild/testReport/junit/bzrlib.tests.blackbox.test_branch/TestBranchStacked/test_branch_stacked_from_smart_server/
>

I would expect it to be someone (possibly a plugin) doing something like:

lazy_import(globals(), """
from bzrlib.ui import ui_factory
""")

Which is *definitely* a no-no. (Objects don't act nicely when lazily
imported, because you can use them without using an attribute.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwXmncACgkQJdeBCYSNAAO+bgCfbh1YU8X+EfugZvvUW22B05Dj
CHQAn0fBMI07ctUHjOo3WYN5XqF2CWD+
=6kRF
-----END PGP SIGNATURE-----

Revision history for this message
Robert Collins (lifeless) wrote :

Arguably the issue is that ScopeReplacer isn't threadsafe; lp bug 998040 has very similar symptoms and is also a smart server using test - so will have threads in play.

Revision history for this message
Robert Collins (lifeless) wrote :

In fact, this should be fixed as of 2.6 - rev 6426.

Changed in bzr:
status: Confirmed → Fix Committed
milestone: none → 2.6b2
Vincent Ladeuil (vila)
Changed in bzr:
status: Fix Committed → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr (Ubuntu):
status: New → Triaged
assignee: nobody → Jelmer Vernooij (jelmer)
status: Triaged → In Progress
status: In Progress → Fix Released
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.