Open AnikinNN opened 3 months ago
Hmmmm... Yes, it makes sense the this would happen, as it is a kind of race condition. The thing is, get_or_create
is intended for batch operations, which should not be expected to avoid such collisions. Batch operations can run parallel, but then the user has to ensure that a given object is not shared across different parallel batches.
So... I don't see a way around this. Do you have an idea ?
Expected Behavior (Mandatory)
At concurrent calling of
get_or_create
from different places of a program we get the same node which was created onceActual Behavior (Mandatory)
At concurrent calling of
get_or_create
from different places of a program we can get different nodes which we consider as duplicatesHow to Reproduce the Problem
Run the code in example. Probably you should increase the amount of created nodes if your's hardware better than mine. I wrapped code into for loop because sometimes the bug can not be caught on the first attempt. Looks like race condition.
Simple Example
As a simple alternative to concurrent calls from different places of entire program we can use
asyncio.gather
Specifications (Mandatory)
Currently used versions
Versions
-OS: linux, 3.10.14-slim -Library:5.3.0 [extras] -Neo4j:5.19.0 community