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
Fix the issue #136 across all backends. #156
Fix the issue #136 across all backends. #156
Conversation
In this case all existing objects referencing the session have dangling references (or they may be pointing to another object because it coincidently is in the same memory address). The fix: simply don't delete the session backend. Implement reconnection support to it. It leads to unusable but valid objects (statement, blob, etc.), exceptions are expected.
I'd prefer if there is some feedback received from other developers, if they spot any potential issues for backends they maintain. There also seem there was no consensus from the discussion on #136. This is the only pull request I haven't merged into |
I agree that some review and different opinions are necessary and really welcome. One point I haven't mentioned is that this pull request doesn't aim to fix the case where the session goes out of scope before a dependent statement lying around. As a library developers we should protect the user against misuses like this, but I consider this situation out of the scope of #136 and something that the average SOCI user will avoid to do. My goal here is really making |
FYI, not merging this into 3.2.2 |
This has been dangling for long time w/o any move forward. It also seems to target SOCI 3.x. @vadz If you don't mind, I'm going to close this PR as not merged or partially merged. |
Closing as suggested 3.5 years ago as this is not applicable any longer. |
See issue #136
The issue is cause because the session backend gets deleted during reconnect.
This solution simply don't do that.
With this fix session backends gained support for open connections and close them (via clean_up).
Also, it's possible to check if session backend is opened though in very simplistic way that just works. That can be improved in later versions.
No public API was changed and I tried to be conservative as possible with the backend objects.
This is a reasonable complex issue, so reviews are welcome.
I'm targeting soci 3.2.2 with fix pull request.
Please note DB2 backend depend (lightly) on #146 to work properly.
Other small DB2 fix is included in this request.