-
Notifications
You must be signed in to change notification settings - Fork 118
Closed
Description
I experience deadlocks when having a lot of parallel requests.
With set $session_redis_pool_size 1
I can reproduce it always with just two requests.
The code is basically:
session:open()
dosomething()
session:close()
With some debug logs I think I figured out the reason.
- request 1 opens/locks session
- request 1 "open" puts connect back to pool ("set_keepalive")
- requests 1 does something
- requests 2 comes in and opens connection to redis pool. session is locked so it trys to aquire lock which takes time to time out
- request 1 did something and wants to close session. session:close cannot get a connection to unlock because requests 2 blocks the session waiting for the lock
Is there a good way to prevent this?
I am using lua resty session 3.
With a bigger pool size there are factors which makes the deadlock more or less likely. It looks like http2 is a factor since there can be more parallel client connections.
Metadata
Metadata
Assignees
Labels
No labels