t8y2/dbx · warning
strings.Join(failures, "; ")
Error message
strings.Join(failures, "; ")
What it means
disconnect tears down the session's database and connection and aggregates every teardown error into a single error whose message is the failure strings joined with "; ". If any Close() (or related cleanup) fails, disconnect returns that combined error so the caller knows cleanup was only partial. The bracketed message is the joined-error text itself, e.g. "connection already closed".
Source
Thrown at agents/drivers/argo-go/main.go:530
server.connectionMu.Lock()
connection := server.connection
database := server.database
server.connection = nil
server.database = nil
server.connectionMu.Unlock()
var failures []string
if connection != nil {
if err := connection.Close(); err != nil {
failures = append(failures, err.Error())
}
}
if database != nil {
if err := database.Close(); err != nil {
failures = append(failures, err.Error())
}
}
if len(failures) > 0 {
return errors.New(strings.Join(failures, "; "))
}
return nil
}
func (server *server) requireConnection() (*sql.Conn, error) {
server.connectionMu.Lock()
connection := server.connection
server.connectionMu.Unlock()
if connection == nil {
return nil, errors.New("Hive connection is not open")
}
return connection, nil
}
func (server *server) setActiveOperation(cancel context.CancelFunc) {
server.activeMu.Lock()
server.activeCancel = cancel
server.activeMu.Unlock()View on GitHub (pinned to c0390bff16)
Solutions
- Inspect the joined message(s) to see which cleanup step failed; a 'closed' style message is usually safe to ignore
- Ensure disconnect is called exactly once per session (idempotent guards/once semantics)
- Catch and log this error on shutdown paths rather than failing the whole shutdown
- If the connection is already dead, force-reset server connection state instead of relying on graceful Close
Example fix
// before
err := server.disconnect() // err: "driver: bad connection"
if err != nil { return err } // aborts shutdown
// after
if err := server.disconnect(); err != nil {
log.Printf("disconnect cleanup issues (ignoring): %v", err)
} Defensive patterns
Strategy: try-catch
Try / catch
if err := server.disconnect(); err != nil {
log.Printf("disconnect cleanup issues: %v", err) // joined with '; '
// do not abort shutdown; inspect individual messages
} Prevention
- Call disconnect exactly once per session
- Log rather than propagate teardown errors on shutdown paths
- Reset connection state when the peer is already gone
- Avoid concurrent disconnect calls with a mutex/once guard
When it happens
Trigger: Calling disconnect (directly or via openSession, dispatch, testConnection) when closing the *sql.DB/database or the sql.Conn fails — e.g. the network already dropped, the driver returns an error on Close, or both cleanup steps fail and messages are concatenated with "; ".
Common situations: Disconnecting after the HiveServer2 process restarted (socket already dead); TLS or auth state making the close handshake fail; double-disconnect from concurrent callers; flaky network causing partial cleanup.
Related errors
- Connection failed
- H2 JDBC driver rejected URL: " + buildJdbcUrl(params)
- Informix connection failed.\nURL: " + url.replaceAll("//[^@]
- Kafka Agent is not connected
- Not connected
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/65a908ab5819a3bf.
Report an issue: GitHub.