-
Notifications
You must be signed in to change notification settings - Fork 22
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
DFS connections remain open leading to eventual system crash #13
Comments
This is definitely a bug, but I'm afraid that we're powerless to do anything about it. This project is just an interface to libsmbclient. We can't do any low-level Samba protocol stuff, because we're stuck with only the few high-level calls exported in libsmbclient.h. This issue should be addressed downstream by the Samba devs. |
I thought as much. Have you experienced the same? If so I've opened a bug here https://bugzilla.samba.org/show_bug.cgi?id=11195 Please chime in as appropriate. |
It's possible that the call we do to (Oops, I just pressed the close + post button by accident. Moving on...) A good test might be to check if the call indeed returns I can't reproduce the bug on my home setup, unfortunately. (Edited: |
An easy way to check if |
I've investigated a little further. I called
...in the syslog which would suggest to me that libsmbclient does believe that it's successfully freeing the context. I also tried calling |
Just thinking out loud, it might be worth adding debug to the options in |
Sounds useful. I was under the impression from reading If libsmbclient thinks it has freed the context successfully, then our hands are tied. Hopefully the Samba guys can help out. |
I'm not calling |
When connecting to a standard Windows/SAMBA file server, calling
smbclient_state_free
ensures that the connection is closed. Sincesmbc_free_context
is called in the module's destructor we can even get away with not calling it. However, when the connection is to a DFS target said connection remains open even after the script completes.After connecting to a DFS target, running
lsof | grep microsoft
on the server yields four open microsoft-ds connections per request. This can cause serious issues because eventually the system will reach it's open files limit and crash.The only way to close the connections is to restart Apache and this issue can be worked around by setting
MaxRequestsPerChild
in httpd.conf to something very low (say fifteen) but from a performance standpoint this is less than ideal.It seems that the connections live as long as PHP does so this issue does not occur when running a script from the command line.
I think that in the case of DFS we need to be doing something more than calling
smbc_free_context
. Looking through http://fossies.org/linux/misc/samba-4.0.25.tar.gz/samba-4.0.25/source3/libsmb/clientgen.c there is acli_shutdown
function which talks about connections remaining active even whensmbc_free_context
is called but I'm not sure if this is relevant here.The text was updated successfully, but these errors were encountered: