You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cache operations get and set are used inside a reentrant lock, but cache clear is called from parse_string outside that reentrant lock.
FifoCache set operation does this:
defset_(_, key, value):
cache[key] =valuewhilelen(cache) >size:
# pop oldest element in cache by getting the first keycache_pop(next(iter(cache)))
That cache_pop(next(iter(cache)) is not thread safe.
Creating a bunch of threads parsing expressions in loop eventually raise a RuntimeError dictionary changed size during iteration
To reproduce it easier put another thread to call ParserElement.reset_cache() in loop
The text was updated successfully, but these errors were encountered:
CarlosDescalziIM
changed the title
Concurrency issue on Cache when packrat issue enabled.
Concurrency issue on Cache when packrat is enabled.
Apr 1, 2025
Cache operations
get
andset
are used inside a reentrant lock, but cache clear is called fromparse_string
outside that reentrant lock.FifoCache set operation does this:
That cache_pop(next(iter(cache)) is not thread safe.
Creating a bunch of threads parsing expressions in loop eventually raise a RuntimeError
dictionary changed size during iteration
To reproduce it easier put another thread to call
ParserElement.reset_cache()
in loopThe text was updated successfully, but these errors were encountered: