-
Notifications
You must be signed in to change notification settings - Fork 86
Don't raise an error at close when it's expected #325
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
base: main
Are you sure you want to change the base?
Don't raise an error at close when it's expected #325
Conversation
…lid as it means it's already closed Signed-off-by: Elise Chouleur <elise.chouleur@doctolib.com>
Signed-off-by: Elise Chouleur <elise.chouleur@doctolib.com>
Signed-off-by: Elise Chouleur <elise.chouleur@doctolib.com>
8887ff1 to
43551e6
Compare
|
Thanks for the PR!
I am wondering if it's possible for the session to be closed by other means if the API has been used only using safe blocks? If not, it could be good to still have this message to show that something unexpected happened? But maybe I am missing a flow where this could happen! |
Yep, it sounds as if there would be a double close in this scenario, which would be good to have in logs. I wonder about the use case of other means of closing the session... 👀 |
|
I implemented something similar than what you propose here as part of #326 but checking explicitly is the session is already closed |
|
Hi ! This happens to me when I remove the physical token before dropping the session. In this case, the session is automatically closed by the library in charge of this token. |
|
Would my PR suffice then? That would allow you to explicitly call |
|
I wanted to test the behaviour with your PR but the new implementation with the lifetime parameter on the session is a breaking change not compatible with my current implementation with the Pkcs11 context in a mutex and the session in a thread_local ref cell 😅 |
If session's close raises a
SessionHandleInvaliderror, that just means the session is already closed by other means.So don't raise an error but just a warn message in this case.