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

Socket timeouts and socket closed #75

Open
francinv opened this issue Oct 15, 2024 · 4 comments
Open

Socket timeouts and socket closed #75

francinv opened this issue Oct 15, 2024 · 4 comments

Comments

@francinv
Copy link

Background

I have two Python programs that runs on a RPi:

  1. A worker that runs every second and fetches data from the inverter with Modbus/TCP. I only initialize a connection one time.
  2. A SellProgrammer that is initialized every hour. I call programmer.disconnect()after each update.

The problem

In the start this works, but after some time (over 24 hrs) I start to get socket.timeout. As the time goes by the amount of timeouts increases until it suddenly throws: Socket closed. When I stop the service and start it again it however throws: Connection closed.

  • Has anyone experienced issues like this before?

Other questions:

  • Should I disconnect more often when reading?
  • Should I store the socket to ensure I use the same one each time?
@davidrapan
Copy link
Contributor

Hi @francinv, do you instantiate PySolarmanV5/Async w/ auto_reconnect = True?

@francinv
Copy link
Author

Hi @francinv, do you instantiate PySolarmanV5/Async w/ auto_reconnect = True?

Yes, I do.

@davidrapan
Copy link
Contributor

Try to take some inspiration from how I've done it here. It's pretty resilient.

@githubDante
Copy link
Collaborator

@francinv any not properly closed sockets when this starting to happen ?!? Can you check/provide the output from netstat or ss

  ss -nt | grep <logger address>  

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