Skip to content
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

Server keeps files open for bad clients #354

Closed
jbwdevries opened this issue Jan 17, 2017 · 1 comment
Closed

Server keeps files open for bad clients #354

jbwdevries opened this issue Jan 17, 2017 · 1 comment

Comments

@jbwdevries
Copy link
Contributor

I have one static file of 1188 bytes size that mosquitto should serve when a http request is made to the websocket listener. This worked reasonably well until last week. At that point it would refuse new connections, claiming "Too many files open". Checking with lsof revealed that it would keep a lot of instances to the static file open.

I managed to reproduce it fairly easy. In the .conf:

listener 8082
protocol websockets
http_dir /var/www/static

Then:

$ echo -en "GET / HTTP/0.9\r\n\r\n" | nc localhost 8082
HTTP/1.0 200 OK
Server: mosquitto
Content-Length: 1188

$

If you run lsof after each time you run of the line above, it will have one more line like:

mosquitto 14003 mosquitto  700r   REG   0,25      1188    196 /vagrant/www/static/index.html

Actually requesting the file with curl does not have the same problem. Only if you close the connection before receiving the whole file.

Tested with mosquitto/libwebsockets 1.4.8/1.7.8 and 1.4.10/1.7.9.

I'm not sure where this bug could be. I presume somewhere in callback_http in websockets.c, but I don't know enough about either project to know where to go.

I appreciate any tips on where to look to build a patch.

@ralight
Copy link
Contributor

ralight commented Jan 20, 2017

Thanks for reporting this, I believe it now fixed in the fixes branch.

@ralight ralight closed this as completed Jan 20, 2017
@ralight ralight added this to the fixes-next milestone Jan 20, 2017
ralight added a commit that referenced this issue Feb 20, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants