Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry: authorization.go:129: cannot use CheckPrivilege without a txn (1) assertion failure Wraps: (2) attached stack trace -- stack trace: | github.com/cockroachdb/cockroach/pkg/sql.(*planner).CheckPrivi... #85057

Closed
cockroach-teamcity opened this issue Jul 26, 2022 · 1 comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Jul 26, 2022

This issue was autofiled by Sentry. It represents a crash or reported error on a live cluster with telemetry enabled.

Sentry link: https://sentry.io/organizations/cockroach-labs/issues/3455465143/?referrer=webhooks_plugin

Panic message:

authorization.go:129: cannot use CheckPrivilege without a txn
(1) assertion failure
Wraps: (2) attached stack trace
-- stack trace:
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).CheckPrivilegeForUser
| github.com/cockroachdb/cockroach/pkg/sql/authorization.go:129
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).CheckPrivilege
| github.com/cockroachdb/cockroach/pkg/sql/authorization.go:168
| github.com/cockroachdb/cockroach/pkg/sql.(*optCatalog).CheckPrivilege
| github.com/cockroachdb/cockroach/pkg/sql/opt_catalog.go:301
| github.com/cockroachdb/cockroach/pkg/sql/opt.(*Metadata).CheckDependencies
| github.com/cockroachdb/cockroach/pkg/sql/opt/metadata.go:312
| github.com/cockroachdb/cockroach/pkg/sql/opt/memo.(*Memo).IsStale
| github.com/cockroachdb/cockroach/pkg/sql/opt/memo/memo.go:333
| github.com/cockroachdb/cockroach/pkg/sql.(*planner).prepareUsingOptimizer
| github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:129
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).populatePrepared
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:281
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare.func2
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:238
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).prepare
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:243
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).addPreparedStmt
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:102
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execPrepare
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor_prepare.go:63
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).execCmd
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1976
| github.com/cockroachdb/cockroach/pkg/sql.(*connExecutor).run
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1800
| github.com/cockroachdb/cockroach/pkg/sql.(*Server).ServeConn
| github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:748
| github.com/cockroachdb/cockroach/pkg/sql/pgwire.(*conn).processCommandsAsync.func1
| github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:727
| runtime.goexit
| GOROOT/src/runtime/asm_amd64.s:1581
Wraps: (3) cannot use CheckPrivilege without a txn
Error types: (1) *assert.withAssertionFailure (2) *withstack.withStack (3) *errutil.leafError
-- report composition:
*errutil.leafError: cannot use CheckPrivilege without a txn
authorization.go:129: *withstack.withStack (top exception)
*assert.withAssertionFailure

Stacktrace (expand for inline code snippets):

if p.txn == nil || !p.txn.IsOpen() {
return errors.AssertionFailedf("cannot use CheckPrivilege without a txn")
}
in pkg/sql.(*planner).CheckPrivilegeForUser
) error {
return p.CheckPrivilegeForUser(ctx, descriptor, privilege, p.User())
}
in pkg/sql.(*planner).CheckPrivilege
}
return oc.planner.CheckPrivilege(ctx, desc, priv)
}
in pkg/sql.(*optCatalog).CheckPrivilege
if priv != 0 {
if err := catalog.CheckPrivilege(ctx, toCheck, priv); err != nil {
return false, err
in pkg/sql/opt.(*Metadata).CheckDependencies
// access the object.
if depsUpToDate, err := m.Metadata().CheckDependencies(ctx, catalog); err != nil {
return true, err
in pkg/sql/opt/memo.(*Memo).IsStale
} else {
isStale, err := cachedData.Memo.IsStale(ctx, p.EvalContext(), &opc.catalog)
if err != nil {
in pkg/sql.(*planner).prepareUsingOptimizer
// and execute paths.
flags, err := p.prepareUsingOptimizer(ctx)
if err != nil {
in pkg/sql.(*connExecutor).populatePrepared
p.semaCtx.Annotations = tree.MakeAnnotations(stmt.NumAnnotations)
flags, err = ex.populatePrepared(ctx, txn, placeholderHints, p)
return err
in pkg/sql.(*connExecutor).prepare.func2
// Use the existing transaction.
if err := prepare(ctx, ex.state.mu.txn); err != nil && origin != PreparedStatementOriginSessionMigration {
return nil, err
in pkg/sql.(*connExecutor).prepare
// Prepare the query. This completes the typing of placeholders.
prepared, err := ex.prepare(ctx, stmt, placeholderHints, rawTypeHints, origin)
if err != nil {
in pkg/sql.(*connExecutor).addPreparedStmt
stmt := makeStatement(parseCmd.Statement, ex.generateID())
_, err := ex.addPreparedStmt(
ctx,
in pkg/sql.(*connExecutor).execPrepare
stmtCtx := withStatement(ctx, ex.curStmtAST)
ev, payload = ex.execPrepare(stmtCtx, tcmd)
case DescribeStmt:
in pkg/sql.(*connExecutor).execCmd
var err error
if err = ex.execCmd(); err != nil {
if errors.IsAny(err, io.EOF, errDrainingComplete) {
in pkg/sql.(*connExecutor).run
}()
return h.ex.run(ctx, s.pool, reserved, cancel)
}
in pkg/sql.(*Server).ServeConn
reservedOwned = false // We're about to pass ownership away.
retErr = sqlServer.ServeConn(ctx, connHandler, reserved, cancelConn)
}()
in pkg/sql/pgwire.(*conn).processCommandsAsync.func1
GOROOT/src/runtime/asm_amd64.s#L1580-L1582 in runtime.goexit

pkg/sql/authorization.go in pkg/sql.(*planner).CheckPrivilegeForUser at line 129
pkg/sql/authorization.go in pkg/sql.(*planner).CheckPrivilege at line 168
pkg/sql/opt_catalog.go in pkg/sql.(*optCatalog).CheckPrivilege at line 301
pkg/sql/opt/metadata.go in pkg/sql/opt.(*Metadata).CheckDependencies at line 312
pkg/sql/opt/memo/memo.go in pkg/sql/opt/memo.(*Memo).IsStale at line 333
pkg/sql/plan_opt.go in pkg/sql.(*planner).prepareUsingOptimizer at line 129
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).populatePrepared at line 281
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare.func2 at line 238
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).prepare at line 243
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).addPreparedStmt at line 102
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).execPrepare at line 63
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1976
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1800
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 748
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommandsAsync.func1 at line 727
GOROOT/src/runtime/asm_amd64.s in runtime.goexit at line 1581
Tag Value
Cockroach Release v22.1.4
Cockroach SHA: 3c6c893
Platform linux amd64
Distribution CCL
Environment v22.1.4
Command server
Go Version ``
# of CPUs
# of Goroutines

Jira issue: CRDB-18020

@cockroach-teamcity cockroach-teamcity added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report. labels Jul 26, 2022
@yuzefovich
Copy link
Member

dup of #82034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-sentry Originated from an in-the-wild panic report.
Projects
None yet
Development

No branches or pull requests

2 participants