I am using libsmbclient as part of a filesystem server in PHP that I am working on. The server is handling about a dozen requests per second of various filesystem actions, mainly file create/write/delete. I am using mainly PHP fwrapper functions with smb:// and only a few smbclient specific calls (e.g. smbclient_state_init).
After each PHP request, I would expect that libsmbclient would clean up any TCP connections it opened when the script ends, but it seems that it doesn't. While continuously running ~10 requests/second I observed upwards of 700 open TCP connections as shown by netstat -t | grep 'myserver:microsoft' | wc -l. The connection count eventually peaks as it seems that they are being closed after 1-2 minutes.
I have tried adding fclose/smbclient_state_free to my script (normally I just rely on the script ending) but those have not made a difference. I am using PHP-FPM with nginx 1.20.1 and libsmbclient 1.0.6. PHP-FPM might have something to do with it since the PHP process itself does not end after the script does like with other PHP modes.
I am using libsmbclient as part of a filesystem server in PHP that I am working on. The server is handling about a dozen requests per second of various filesystem actions, mainly file create/write/delete. I am using mainly PHP fwrapper functions with
smb://
and only a few smbclient specific calls (e.g.smbclient_state_init
).After each PHP request, I would expect that libsmbclient would clean up any TCP connections it opened when the script ends, but it seems that it doesn't. While continuously running ~10 requests/second I observed upwards of 700 open TCP connections as shown by
netstat -t | grep 'myserver:microsoft' | wc -l
. The connection count eventually peaks as it seems that they are being closed after 1-2 minutes.I have tried adding
fclose/smbclient_state_free
to my script (normally I just rely on the script ending) but those have not made a difference. I am using PHP-FPM with nginx 1.20.1 and libsmbclient 1.0.6. PHP-FPM might have something to do with it since the PHP process itself does not end after the script does like with other PHP modes.