{"record":{"id":"8b83d11edba40c66","repo":"t8y2/dbx","slug":"w-after-ds-v","errorCode":null,"errorMessage":"%w after %ds: %v","messagePattern":"%w after (.+?)s: (.+?)","errorType":"exception","errorClass":"errXuguOperationTimeout","httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":4320,"sourceCode":"\ts.activeCancelMu.Lock()\n\ts.activeCancel = nil\n\tif s.activeTimer != nil {\n\t\ts.activeTimer.Stop()\n\t\ts.activeTimer = nil\n\t}\n\ttimedOut := s.activeTimedOut\n\tcanceled := s.activeCanceled\n\ts.activeTimedOut = false\n\ts.activeCanceled = false\n\ts.activeCancelMu.Unlock()\n\tcancel()\n\treturn xuguOperationResultError(timedOut, canceled, timeoutSecs, operationErr)\n}\n\nfunc xuguOperationResultError(timedOut, canceled bool, timeoutSecs int, operationErr error) error {\n\tif timedOut {\n\t\tif operationErr != nil {\n\t\t\treturn fmt.Errorf(\"%w after %ds: %v\", errXuguOperationTimeout, timeoutSecs, operationErr)\n\t\t}\n\t\treturn fmt.Errorf(\"%w after %ds\", errXuguOperationTimeout, timeoutSecs)\n\t}\n\tif canceled {\n\t\tif operationErr != nil {\n\t\t\treturn fmt.Errorf(\"%w: %v\", errXuguOperationCanceled, operationErr)\n\t\t}\n\t\treturn errXuguOperationCanceled\n\t}\n\treturn operationErr\n}\n\nfunc (s *server) cancelActiveQuery() {\n\ts.activeCancelMu.Lock()\n\tcancels := make([]context.CancelFunc, 0, len(s.activeRows)+1)\n\tif s.activeCancel != nil {\n\t\tif !s.activeTimedOut {\n\t\t\ts.activeCanceled = true","sourceCodeStart":4302,"sourceCodeEnd":4338,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L4302-L4338","documentation":"xuguOperationResultError wraps errXuguOperationTimeout ('xugu operation timed out') with the timeout duration and the underlying error using %w so errors.Is/As work. It is returned when an asynchronous XuguDB operation (query, DDL, etc.) exceeded the configured timeout and the wait also produced an error (e.g. context deadline or driver failure).","triggerScenarios":"A long-running statement or operation exceeds timeoutSecs while polling its result, and operationErr is non-nil — e.g. the context deadline fired or the connection broke during the wait.","commonSituations":"Slow queries on large tables; server-side blocking (locks); network stalls; timeout configured too low for maintenance DDL like index builds; server overload.","solutions":["Check the wrapped %v cause: it usually reveals whether the context deadline or a network issue fired.","Increase the operation timeout (timeoutSecs) for legitimately long operations.","Optimize or kill the blocking statement (check for lock contention with catalog/lock views).","Check network stability and server health; retry the operation once the cause is addressed."],"exampleFix":"// before: default 30s timeout on a big rebuild\nres, err := client.ExecuteWait(ddl, 30)\n\n// after: allow longer for heavy DDL\nres, err := client.ExecuteWait(ddl, 600)","handlingStrategy":"retry","validationCode":"// estimate runtime first\nvar cost int64\ndb.QueryRow(`SELECT COUNT(*) FROM ALL_TABLES WHERE TABLE_NAME=?`, table).Scan(&cost)\nif cost > largeThreshold { timeoutSecs = 600 } // pick timeout proportional to size","typeGuard":null,"tryCatchPattern":"if errors.Is(err, errXuguOperationTimeout) {\n    var toerr *TimeoutWithCause\n    if errors.As(err, &toerr) { log.Errorf(\"timed out after %ds: %v\", toerr.Seconds, toerr.Cause) }\n    return retryWithBackoff(op, longerTimeout)\n}","preventionTips":["Set operation timeouts from measured statement durations, not guesses.","Monitor lock contention before running DDL on hot tables.","Alert on timeout-wrapped errors and inspect the embedded cause."],"tags":["database","timeout","operation","xugu"],"backgroundTag":"operation-timeout","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}