Skip to content

Blank node _serial_number_generator() is not thread-safe #209

tstack opened this Issue May 2, 2012 · 0 comments

2 participants

tstack commented May 2, 2012

It looks like the _serial_number_generator() in rdflib/ (v3.2.1) is not thread safe. Generators can't be resumed when they are already running. So, if two threads are creating blank nodes at the same time, an exception is likely to be thrown.

Here's some code that reproduces the problem for me:

import rdflib
import threading

def makeNode():
    while True:

th = threading.Thread(target=makeNode)
th.daemon = True


I see the following error when executing the above code:

Traceback (most recent call last):
  File "", line 13, in <module>
  File "", line 7, in makeNode
  File ".../rdflib/", line 250, in __new__
    node_id =
ValueError: generator already executing
@bcroq bcroq added a commit that referenced this issue May 3, 2012
@bcroq bcroq fixes issue #209 cde9179
@gjhiggins gjhiggins closed this Jun 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.