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

Force close sockets after use #453

Closed
kaizensparc opened this issue Dec 24, 2019 · 2 comments
Closed

Force close sockets after use #453

kaizensparc opened this issue Dec 24, 2019 · 2 comments

Comments

@kaizensparc
Copy link

Hello,
I'm using the library in a long-running script where I frequently connect/disconnect to brokers. After a few hours/days, I cannot connect anymore due to "too many open files" error. In fact after checking the open sockets with lsof I end up with hundreds of open sockets when idle.

It seems the MQTT client class relies on __del__ method (and thus in the garbage collector) to close the sockets, which gives unpredictable results. Is there any way to force close the sockets when disconnecting? I was thinking maybe exporting the _reset_sockets method?

Thanks

@kevalRPansuriya
Copy link

I am experiencing the same issue I am performing a test where I disconnect from the broker every 30 seconds this left too many open sockets which is not getting closed in my case.

@MattBrittan
Copy link
Contributor

I'm going to close this due to inactivity (the library has changed since this was raised). Please feel free to reopen, but if you do please provide a minimal example and details about your environment (OS etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants