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

SocketException: Broken Pipe #295

Closed
busslina opened this issue Feb 15, 2024 · 3 comments
Closed

SocketException: Broken Pipe #295

busslina opened this issue Feb 15, 2024 · 3 comments

Comments

@busslina
Copy link

busslina commented Feb 15, 2024

I wake up today and saw that my server was reinitiated at 7AM. Checking the Systemd log file I got:
Unhandled exception: Feb 15 06:17:46 server1.busslina.com dart[87776]: SocketException: Broken pipe (OS Error: Broken pipe, errno = 32), ...

I suppose it is the connection to the database. Can anyone suggest me how to deal with it and try to reconnect?

Also, would be great you to include this info (along side to catch connecting exception) on the README.md, because for me it's one of the main worries about dealing with a database, and maybe for more people too.

Congrats about this great lib that works great.

Thanks.

@busslina
Copy link
Author

busslina commented Feb 15, 2024

Must I try/catch every Connection.execute in order to prevent my app crashes when this exception occurs and then check if is disconnected and try to connect again? Will checking Connection.isOpen before every execute assure me that the socket is okay or I will never know before trying to execute?

Must I try/catch on Connection.open too when establishing the connection?

@isoos
Copy link
Owner

isoos commented Feb 15, 2024

I think this is duplicate of #290, closing to keep only one issue open.

Note: I think a single Connection object is just that: it works as long as the underlying socket connection is open. If there is a problem, all bets are off. However, Pool.run() and Pool.runTx() would be ideal for retrying the connection failures (see other issue).

@isoos isoos closed this as completed Feb 15, 2024
@busslina
Copy link
Author

Thanks

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

2 participants