packet.go:123: Error closing idle connection: connection reset by peer

PHPz
Release: 2024-02-09 23:15:09
forward
687 people have browsed it

packet.go:123: Error closing idle connection: connection reset by peer

When doing network programming, we often encounter some errors, including "packet.go:123: Bad idle connection closed: The connection was reset by the peer" error message. This error usually means that the connecting party accidentally closed the connection, rendering the current connection invalid. It is very important for developers to resolve such errors. In this article, PHP editor Xigua will introduce how to deal with and solve this problem to ensure the stability and reliability of network programming.

Question content

I use go, fiber web framework, mariadb 10.6, debian 11 and github.com/go-sql-driver/mysql to connect to mariadb. I have used these settings

db.setmaxopenconns(25)
db.setmaxidleconns(25)
db.setconnmaxlifetime(5 * time.minute)
Copy after login

i.e. I increase the value, decrease the value, but still get 1 or 2 warnings

packets.go:123: closing bad idle connection: connection reset by peer
Copy after login

every minute. Any suggestions?

The answer is that my wait_timeout is 20 seconds and the interaction timeout is 50 seconds. I have now increased its fixed value. Thanks to @ysth for the solution.

Solution

The answer is me The wait_timeout is 20 seconds and the interaction timeout is 50 seconds, I have increased it now, thanks to @ysth for the solution

The above is the detailed content of packet.go:123: Error closing idle connection: connection reset by peer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!