Skip to content

closing bad idle connection: EOF #1584

@cong08

Description

@cong08

Issue description

Occasionally, an error occurs, but it is not consistently reproducible. Sometimes, after a long period of inactivity, the error appears when a query is executed. I have already set ConnMaxLifetime, which makes this issue even more puzzling.

Example code

sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(10)
sqlDB.SetMaxOpenConns(100)
sqlDB.SetConnMaxLifetime(time.Duration(240) * time.Second)

Error log

[mysql] 2024/05/17 09:19:00 packets.go:122: closing bad idle connection: EOF
[mysql] 2024/05/17 09:19:00 connection.go:173: driver: bad connection

Configuration

Driver version (or git SHA): v1.7.1
Go version: go1.21.4
Server version: MySQL 8.0.23
Server OS: debian:stable-slim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions