-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
session Duplication #253
Comments
Thanks for reporting! Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that. |
When a user log in from a browser, they do 1 request, not multiple at the same time: they are logging in. So only one session is created. |
I am also facing the same issue, when user log in from browser it's 1 request but when I check my redis store it has multiple session id's. |
@bianjunjie1981 did you figure out any work around for this? I am still facing this issue. |
I didn't solve the problem. I use session to store the login state, the user id, because the page is driven by multiple data interfaces, which are plugged in different processes, each of which detects the login state, and in fact most pages today do the same. These data interfaces are sent almost in parallel and arrive at the server almost identically. If the client runs for the first time, at this time the client does not have a cookie, there is no session id, they must create and generate a session id, and write to the database, the session id left by the client should be the last one returned to the client. And I'm not using it for reading and writing that has that sort of sequential competition, which would be a mistake, because there's a sequential speed problem and no lock is almost certainly a mistake. |
It really seems a problem in the design of your application, or maybe this module is really not what you are looking for. To provide better guidance, I would need a https://stackoverflow.com/help/minimal-reproducible-example. |
Prerequisites
Fastify version
4.26.0
Plugin version
10.7.0
Node.js version
20.11.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.2.1
Description
When the client creates a session:
Services are multi-process, requests are concurrent and arrive at almost the same time, and multiple seesion ids may be created.
There is a time difference between determining the need to create and the creation process.
They have a slight time difference after creation, but they can be seen as duplicates. saveUninitialized there will be this repetition whether true or false.
Link to code that reproduces the bug
No response
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: