Write Thread bug found and fixed

Sometimes, when using threads, an error raises from time to time (but is very difficult to see):

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/proxies.py", line 43, in function
    return self._conn.proxy(self.sync_type, name, args, kwargs)
  File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/connection.py", line 608, in proxy
    req = Request(self, data)
  File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/request.py", line 68, in __init__
  File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/connection.py", line 285, in addrequest
    assert(request.request_id not in self._requests)

Taking a look onto the code, i’ve found that the id-generation function allows to be executed concurrently, allowing to return duplicates. I added a bugfix which ensure only one call is given at a time. I hope this is enough to avoid the bug.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s