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
{{ message }}
Repository navigation
Many sessions being created without a user on the website sitting behind Kubernetes #820
My nodejs 14+ app is sitting behind a kubernetes nginx-ingress controller. All cookies and site behavior is as expected, what I am seeing in the mongo db session store is new sessions being created about one a second on avg. The timing is not consistent. When I look in grafana to look at open connections, and connections/sec etc. They are zero. It LOOKs like there is no outside traffic coming in. Could the ngnix-ingress (with sticky option set) be causing this creation of sessions? Some sort of health check? I am happy to provide more configs just didn't want to overwhelm the initial question.
Do you have a liveness probe running for your deployment? We had to make sure that our session middleware was excluded on the endpoint used for the K8S liveness probe (we create a simple keep-alive route), otherwise we would end up with the same as what you are describing; lots of empty session records in the database.
@adamkl is likely correct, if you have not set saveUninitialized to false, or otherwise avoided the liveness and readiness checks then kubernetes just checking to see if your node application is online is sending a request which sessions is by default creating an empty session for each of these requests.
Activity
adamkl commentedon Jun 4, 2021
Do you have a liveness probe running for your deployment? We had to make sure that our session middleware was excluded on the endpoint used for the K8S liveness probe (we create a simple keep-alive route), otherwise we would end up with the same as what you are describing; lots of empty session records in the database.
gabeio commentedon Jun 4, 2021
@adamkl is likely correct, if you have not set saveUninitialized to false, or otherwise avoided the liveness and readiness checks then kubernetes just checking to see if your node application is online is sending a request which sessions is by default creating an empty session for each of these requests.