Skip to content

sql: improve stack trace for get-user-timeout timeouts #95794

@ecwall

Description

@ecwall

The cause of the get-user-timeout errors is unknown. Part of the problem is that the stack trace gets cut off at

  |   | github.com/cockroachdb/cockroach/pkg/sql.retrieveSessionInitInfoWithCache
  |   | 	github.com/cockroachdb/cockroach/pkg/sql/user.go:238

which does not explain what is actually being blocked.

The reason that the stack trace is cut off is that the timeout is initiated by contextutil.RunWithTimeout which results in a "simple" (no stack trace) context.DeadlineExceeded error.

retrieveSessionInitInfoWithCache is the first line in the stack trace because it calls errors.Wrap on the error from context.DeadlineExceeded.

To get fuller stack trace, context.DeadlineExceeded must be wrapped immediately (errors.Wrap or errors.WithStack) before it bubbles up.

This is to diagnose the get-user-timeout errors here where the stack trace is cut off before the place we call errors.Wrap(...): https://github.com/cockroachlabs/support/issues/2017#issuecomment-1402418577

Jira issue: CRDB-23745

Metadata

Metadata

Assignees

Labels

C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions