t8y2/dbx · warning

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

Error message

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

What it means

closeAllQuerySessions tears down every open Hive session during disconnect. If any individual session fails to cancel or close its rows, the session ID and error are accumulated and joined with ';' into a single aggregated error. It signals that disconnect completed only partially and some server-side session resources may be leaked.

Source

Thrown at agents/drivers/hive-go/query.go:279

		return false
	}
	delete(server.querySessions, sessionID)
	state.cancel()
	_ = state.rows.Close()
	return true
}

func (server *server) closeAllQuerySessions() error {
	var failures []string
	for sessionID, state := range server.querySessions {
		delete(server.querySessions, sessionID)
		state.cancel()
		if err := state.rows.Close(); err != nil {
			failures = append(failures, fmt.Sprintf("%s: %v", sessionID, err))
		}
	}
	if len(failures) > 0 {
		return errors.New(strings.Join(failures, "; "))
	}
	return nil
}

func (server *server) expireIdleQuerySessions(now time.Time) int {
	expired := make([]string, 0)
	for sessionID, state := range server.querySessions {
		if !state.lastAccessed.IsZero() && now.Sub(state.lastAccessed) >= querySessionIdleTime {
			expired = append(expired, sessionID)
		}
	}
	for _, sessionID := range expired {
		server.closeQuerySession(sessionID)
	}
	return len(expired)
}

func (server *server) executeStatements(params map[string]json.RawMessage, transaction bool) (queryResult, error) {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Inspect the joined message for the failing session ID and check HiveServer2 logs for that session's teardown errors
  2. Retry disconnect after a short delay; on retry the session list may already be empty
  3. Ensure queries are fully drained (rows.Close() called by the caller) before calling disconnect
  4. Check network connectivity / HiveServer2 availability; a dead connection often makes Close() fail

Example fix

// before
if err := server.disconnect(ctx); err != nil {
    return err // aborts shutdown on one stale session
}
// after
if err := server.disconnect(ctx); err != nil {
    log.Warnf("partial disconnect: %v", err) // log and continue teardown
    return nil
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go
func sessionsHealthy(s *server) bool {
    for _, st := range s.sessions {
        if st.rows == nil { return false }
    }
    return true
}

Type guard

// Go
if state == nil || state.rows == nil {
    continue // skip sessions without open rows
}

Try / catch

if err := server.disconnect(ctx); err != nil {
    var agg interface{ SessionIDs() []string }
    if errors.As(err, &agg) { log.Warnf("sessions failed to close: %v", agg.SessionIDs()) }
    log.Warnf("partial disconnect: %v", err)
}

Prevention

When it happens

Trigger: Calling disconnect while one or more query sessions still have open rows whose Close() returns an error (e.g. network drop to HiveServer2 mid-close, session already expired server-side).

Common situations: App shutdown with long-running queries still streaming; idle sessions already reaped by the server's idle timeout; transient network failure between client and Hive when closing the last result set.

Related errors


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