t8y2/dbx · warning

${strings.Join(failures, "; ")}

Error message

${strings.Join(failures, "; ")}

What it means

disconnect() aggregates all failures that occurred while closing the active Hive query session, the active operation, and the underlying database connection, then returns them joined with '; ' as a single error. It means one or more resources could not be released cleanly during shutdown. The message text is the concatenation of the individual error strings, so all root causes appear in one line.

Source

Thrown at agents/drivers/hive-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

  1. Inspect the joined message to see which sub-close failed (it contains each error text separated by '; ') and fix that root cause first.
  2. Ensure disconnect is called only once per session and that all queries/active operations are finished or cancelled before disconnecting.
  3. Check HiveServer2 availability and network stability; a dropped TCP connection makes Close() fail.
  4. If the error is benign (already-closed connection), treat disconnect failures as non-fatal and log instead of failing the caller.

Example fix

// before
if err := srv.Disconnect(); err != nil {
    return fmt.Errorf("teardown failed: %w", err)
}
// after
if err := srv.Disconnect(); err != nil {
    log.Printf("disconnect cleanup issue (non-fatal): %v", err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go
if connOpen { // only disconnect sessions that were opened
    if err := srv.Disconnect(); err != nil { log.Printf("disconnect: %v", err) }
}

Try / catch

if err := srv.Disconnect(); err != nil {
    for _, part := range strings.Split(err.Error(), "; ") {
        log.Printf("cleanup issue: %s", part)
    }
}

Prevention

When it happens

Trigger: Calling server disconnect (via openSession re-init, dispatch, testConnection, or the GetObjectSource/ListDatabases test paths) while database.Close(), session cancel/close, or active-operation cleanup returns a non-nil error; the underlying gohive connection is already broken or the session close RPC fails.

Common situations: Network drop or HiveServer2 restart while a driver instance is being recycled; repeated disconnect calls (second Close on an already-closed connection errors); test suites tearing down sessions whose connections the server already dropped.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/702ea8358f6b70e2. Report an issue: GitHub.