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

broken pipe errors are not treated as driver.ErrBadConnection #897

Closed
vijay1811 opened this issue Sep 23, 2019 · 1 comment
Closed

broken pipe errors are not treated as driver.ErrBadConnection #897

vijay1811 opened this issue Sep 23, 2019 · 1 comment

Comments

@vijay1811
Copy link

'write tcp 172.22.6.246:53576-\u003e 172.30.236.26:5432: write: broken pipe' this error is not treated as special error and query to database fails.

@vijay1811
Copy link
Author

vijay1811 commented Sep 23, 2019

I think fix could be

case *net.OpError:
		cn.bad = true
		*err = v // - > err  = driver.ErrBadConnection

https://github.com/lib/pq/blob/master/error.go#L497

roylee17 added a commit to roylee17/sqlx that referenced this issue Mar 21, 2021
    I'm seeing "broken pipe" errors when working with CRDB using sqlx.
    The issue seemed to be the tcp connections were diconnected while the conns
    in db driver (pq) still has stale connection.

    It happens more often when the DB is behind a proxy.
    In our cases, the pods were proxied by the envoy sidecar.

    There were other instances on the community reporting similar issues,
    and took different workaround by sebding perodic dummy queries in app
    mimicing keepalive, enlenghthen proxy idle timeout, or shortening the
    lifetime of db conn.

    This has been reported and fixed by the lib/pq upstream in v1.9+

      lib/pq#1013

      lib/pq#723
      lib/pq#897
      lib/pq#870

      grafana/grafana#29957
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