-
Notifications
You must be signed in to change notification settings - Fork 18
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
Possibility of memory leaks with asynchronous exceptions #27
Comments
You are correct, and this issue is one that I am well aware of. I just haven't gotten around to reviewing and improving the library... and there's a lot to review. I'm not quite sure what you mean by "reachable database connections", and blocking access to the database however. Unless you mean leaking an open database connection, and eventually running into the backend's configured connection limit. |
Yes, that's exactly it. |
Ok, well I pushed a fix for #26, how much do you want to fix before I release to hackage? I would be willing to review and fix the connection functions myself. I don't really want to go through the rest of the library at the moment... I'll probably get around to it someday, but honestly it's not a personal priority at the moment. |
It looks like securing PGconn, PGresult and PGcancel is easily doable by masking Btw, thanks for the very fast response! |
Improves, but does not close, issue #27
Err, I don't recall closing this issue, I don't understand why I would have. :-/ |
Any code that follows the pattern "allocate bare resource using a function imported from C, then create a foreign pointer that manages the resource" needs to mask asynchronous exceptions, since if exception arrives between allocation and wrapping, memory leaks. This is particularly dangerous in
connectdb
, since such code may eventually run out of reachable database connections, completely blocking the access to the database.The text was updated successfully, but these errors were encountered: