-
Notifications
You must be signed in to change notification settings - Fork 368
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
Streaming database response seemingly leak file descriptors? #1635
Comments
Good catch, this is in fact a real issue. Digging through the underlying libraries and adding some printf debugging, I see the following:
So there are two problems:
|
(1) seems to be addressed by yesodweb/persistent#978. |
Can you confirm that 7839de4 fixes the issue? |
Thanks for the prompt investigation and resolution. Looking forward to the new releases! |
Replace call to connPrepare with getStmtConn (fixes #1635)
New releases now on Hackage. |
I have basic yesod web application with a handler that streams a database response. It seems like database file descriptors are leaked.
Using sqlite3 backend and for purposes of these tests, I've limited the database pool size to 1.
Observing open files every second with:
lsof -n -r 1 -p "$(pgrep -f stream-vs-buffer)"
simple streaming response handler
It seems that the following streaming response handler keeps the database file handles open indefinitely.
simple non-streaming response
However, the following non-streaming response opens the database file handles and then reasonably closes them after several seconds.
This is especially concerning, with a non-trival application with larger database pools in which streaming database response handlers accumulate many file handles.
Am I doing something wrong? What am I missing?
git repository to reproduce: https://github.com/dacto/stream-vs-buffer
stack resolver:
lts-14.12
Note: this is also known to exist on resolver
lts-9.21
additional details
The text was updated successfully, but these errors were encountered: