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

pgwire: v19.2.5: assertion failed: unsupported OID "anyelement" #49704

Closed
cockroach-teamcity opened this issue May 29, 2020 · 5 comments
Closed
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. S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases.

Comments

@cockroach-teamcity
Copy link
Member

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/1697870061/?referrer=webhooks_plugin

Panic message:

*errors.errorString
*safedetails.withSafeDetails: unsupported OID %v with format code %s (1)
encoding.go:660: *withstack.withStack (2)
*assert.withAssertionFailure
*errutil.withMessage
*safedetails.withSafeDetails: error in argument for %s (3)
conn_executor_prepare.go:304: *withstack.withStack (4)
*pgerror.withCandidateCode: 08P01 (5)
(check the extra data payloads)

Stacktrace (expand for inline code snippets):

default:
return nil, errors.AssertionFailedf(
"unsupported OID %v with format code %s", errors.Safe(id), errors.Safe(code))
in pkg/sql/pgwire/pgwirebase.DecodeOidDatum
buf := r.Next(int(vlen))
elem, err := DecodeOidDatum(ctx, elemOid, code, buf)
if err != nil {
in pkg/sql/pgwire/pgwirebase.decodeBinaryArray
innerOid := types.OidToType[id].ArrayContents().Oid()
return decodeBinaryArray(ctx, innerOid, b, code)
}
in pkg/sql/pgwire/pgwirebase.DecodeOidDatum
} else {
d, err := pgwirebase.DecodeOidDatum(ptCtx, t, qArgFormatCodes[i], arg)
if err != nil {
in pkg/sql.(*connExecutor).execBind
res = ex.clientComm.CreateBindResult(pos)
ev, payload = ex.execBind(ctx, tcmd)
case DeletePreparedStmt:
in pkg/sql.(*connExecutor).execCmd
var err error
if err = ex.execCmd(ex.Ctx()); err != nil {
if err == io.EOF || err == 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
/usr/local/go/src/runtime/asm_amd64.s#L1336-L1338 in runtime.goexit

pkg/sql/pgwire/pgwirebase/encoding.go in pkg/sql/pgwire/pgwirebase.DecodeOidDatum at line 660
pkg/sql/pgwire/pgwirebase/encoding.go in pkg/sql/pgwire/pgwirebase.decodeBinaryArray at line 806
pkg/sql/pgwire/pgwirebase/encoding.go in pkg/sql/pgwire/pgwirebase.DecodeOidDatum at line 639
pkg/sql/conn_executor_prepare.go in pkg/sql.(*connExecutor).execBind at line 302
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).execCmd at line 1320
pkg/sql/conn_executor.go in pkg/sql.(*connExecutor).run at line 1172
pkg/sql/conn_executor.go in pkg/sql.(*Server).ServeConn at line 444
pkg/sql/pgwire/conn.go in pkg/sql/pgwire.(*conn).processCommandsAsync.func1 at line 584
/usr/local/go/src/runtime/asm_amd64.s in runtime.goexit at line 1337
Tag Value
Cockroach Release v19.2.5
Cockroach SHA: 4f36d0c
Platform linux amd64
Distribution CCL
Environment v19.2.5
Command server
Go Version go1.12.12
# of CPUs 12
# of Goroutines 199
@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 May 29, 2020
@yuzefovich yuzefovich changed the title sentry: *errors.errorString *safedetails.withSafeDetails: unsupported OID %v with format code %s (1) encoding.go:660: *withstack.withStack (2) *assert.withAssertionFailure *errutil.withMessage *safedetails.withSafeDetails: error in argument for %s (3) conn_executor_prepare.go:304: *withstack.withStack (4) *pgerror.withCandidateCode: 08P01 (5) (check the extra data payloads) pgwire: v19.2.5: assertion failed: unsupported OID with format code May 29, 2020
@asubiotto
Copy link
Contributor

Looks like this was an OID of 2283 which is not included in lib/pq/oid/types.go and corresponds to anyelement:

asubiotto=# SELECT * FROM pg_type WHERE oid = 2283;
 oid  |  typname   | typnamespace | typowner | typlen | typbyval | typtype | typcategory | typispreferred | typisdefined | typdelim | typrelid | typelem | typarray |   typinput    |   typoutput    | typreceive | typsend | typmodin | typmodout | typanalyze | typalign | typstorage | typnotnull | typbasetype | typtypmod | typndims | typcollation | typdefaultbin | typdefault | typacl
------+------------+--------------+----------+--------+----------+---------+-------------+----------------+--------------+----------+----------+---------+----------+---------------+----------------+------------+---------+----------+-----------+------------+----------+------------+------------+-------------+-----------+----------+--------------+---------------+------------+--------
 2283 | anyelement |           11 |       10 |      4 | t        | p       | P           | f              | t            | ,        |        0 |       0 |        0 | anyelement_in | anyelement_out | -          | -       | -        | -         | -          | i        | p          | f          |           0 |        -1 |        0 |            0 |               |            |
(1 row)

@asubiotto asubiotto changed the title pgwire: v19.2.5: assertion failed: unsupported OID with format code pgwire: v19.2.5: assertion failed: unsupported OID "anyelement" Jun 2, 2020
@asubiotto
Copy link
Contributor

@rafiss sending over to the appdev team since looks like there's a client that's sending anyelement over. I think the action items here are figure out when and why ORMs try to issue this and what CockroachDB should do about it.

@rafiss
Copy link
Collaborator

rafiss commented Jun 4, 2020

anyelement is in the CockroachDB pg_type table as well:

root@:26257/defaultdb> SELECT * FROM pg_type WHERE oid = 2283;
  oid  |  typname   | typnamespace | typowner | typlen | typbyval | typtype | typcategory | typispreferred | typisdefined | typdelim | typrelid | typelem | typarray |   typinput    |   typoutput    |   typreceive    |     typsend     | typmodin | typmodout | typanalyze | typalign | typstorage | typnotnull | typbasetype | typtypmod | typndims | typcollation | typdefaultbin | typdefault | typacl
-------+------------+--------------+----------+--------+----------+---------+-------------+----------------+--------------+----------+----------+---------+----------+---------------+----------------+-----------------+-----------------+----------+-----------+------------+----------+------------+------------+-------------+-----------+----------+--------------+---------------+------------+---------
  2283 | anyelement |    383994467 | NULL     |     -1 |  false   | p       | P           |     false      |     true     | ,        |        0 |       0 |     2277 | anyelement_in | anyelement_out | anyelement_recv | anyelement_send |        0 |         0 |          0 | NULL     | NULL       |   false    |           0 |        -1 |        0 |            0 | NULL          | NULL       | NULL
(1 row)

It seems like this error happens when DecodeOidDatum is called with an OID of 2283 (i.e. anyelement) and a FormatCode of FormatBinary

@rafiss rafiss added the S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases. label Jul 13, 2020
@rafiss
Copy link
Collaborator

rafiss commented Jul 14, 2020

Based on the stack trace, this looks similar to #51360

@rafiss
Copy link
Collaborator

rafiss commented Mar 15, 2021

Closing as unactionable.

@rafiss rafiss closed this as completed Mar 15, 2021
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. S-3-erroneous-edge-case Database produces or stores erroneous data without visible error/warning, in rare edge cases.
Projects
None yet
Development

No branches or pull requests

3 participants