It looks like the _serial_number_generator() in rdflib/term.py (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:
th = threading.Thread(target=makeNode)
th.daemon = True
I see the following error when executing the above code:
Traceback (most recent call last):
File "blankNodeRace.py", line 13, in <module>
File "blankNodeRace.py", line 7, in makeNode
File ".../rdflib/term.py", line 250, in __new__
node_id = _sn_gen.next()
ValueError: generator already executing
fixes issue #209
Recover thread-protective Rlock for BNode id generation. Fixes issue #…
Tentatively add test for issue #209.