limpyd / redis-limpyd

Provide an easy way to store python objects in Redis, without losing the power and the control of the Redis API
https://redis-limpyd.readthedocs.org/
Do What The F*ck You Want To Public License
72 stars 11 forks source link

PipelineDatabase is not thread safe #97

Closed twidi closed 7 years ago

twidi commented 7 years ago

When we enter "pipeline" mode, the current connection is changed to a pipeline. There is no problem with that, it allows to handle all get via the pipeline without having to think about it.

The database is also shared between models, for the same exact reason.

So they share the same connection to redis.

And because of the connectionpool, the same connection is always used, even with different threads.

So in the current thread we are aware that we are in pipeline mode, because we triggered it, but in the other threads, we are not, and when they try to get data, they get a pipeline in return, not the expected data.

I currently have no idea on how to resolve this, but this is a real problem.

twidi commented 7 years ago

duplicate of #84