Commit 6aeab4f5 authored by Akshay Modi's avatar Akshay Modi Committed by TensorFlower Gardener
Browse files

Don't call back into python during insert (which will leave the set in a...

Don't call back into python during insert (which will leave the set in a broken condition if the runtime decides to let another thread run).

Thank you for finding the bug. The watched_variables_ set should not really require a lock since all our functions hold the GIL (verified by looking at the generated SWIG). The reason that there was a concurrent access to the set is that the insert was calling back into python (which might release the GIL and let another thread run, which will also attempt to insert a variable and break the set).

I included the lock to be safe though, since its non-trivial to verify without looking at the generated swig wrappers that the GIL is held.

PiperOrigin-RevId: 200074843
parent 7b8c64ef
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment