[ python-Bugs-1764059 ] _RLock.__repr__ throws exception

SourceForge.net noreply at sourceforge.net
Tue Jul 31 15:46:23 CEST 2007


Bugs item #1764059, was opened at 2007-07-31 08:06
Message generated for change (Comment added) made by ncoghlan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1764059&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Threads
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Greg Kochanski (gpk)
Assigned to: Nobody/Anonymous (nobody)
Summary: _RLock.__repr__ throws exception

Initial Comment:
I rewrote the test code in threading.py
to exercise it a bit more completely,
and found the following exception.
I think it arises because of a race
condition.   Ownership probably changes
in the interval between the two
parts of the "and" on line 90.


Exception in thread gtp0:
Traceback (most recent call last):
  File "/tmp/threading.py", line 460, in __bootstrap
    self.run()
  File "/tmp/threading.py", line 440, in run
    self.__target(*self.__args, **self.__kwargs)
  File "g_threading.py", line 107, in __a_thread
    self.sclock.wait()
  File "/tmp/threading.py", line 216, in wait
    self._note("%s.wait(): got it", self)
  File "/tmp/threading.py", line 46, in _note
    format = format % args
  File "/tmp/threading.py", line 189, in __repr__
    return "<Condition(%s, %d)>" % (self.__lock, len(self.__waiters))
  File "/tmp/threading.py", line 90, in __repr__
    self.__owner and self.__owner.getName(),
AttributeError: 'NoneType' object has no attribute 'getName'

This was python 2.5.1, running on this:
$ uname -a
Linux chives 2.6.11.4-21.15-smp #1 SMP Tue Nov 28 13:39:58 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
$ 


I attach a patch to threading.py that exhibits
the bug (i.e. better testing code).

----------------------------------------------------------------------

>Comment By: Nick Coghlan (ncoghlan)
Date: 2007-07-31 23:46

Message:
Logged In: YES 
user_id=1038590
Originator: NO

The race condition should be fixed in rev 56633 in Subversion. I didn't
check in the test code changes, because they don't appear to actually
exercise the affected code path (there is no code to call repr() on the
RLock).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1764059&group_id=5470


More information about the Python-bugs-list mailing list