cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

tracing: the CDB process crash if enable COCKROACH_TRACE_SQL

Open yznming opened this issue 9 years ago • 7 comments

The header (i.e. the first few lines) of the most recent log file.

I170228 11:06:58.060465 1 util/log/clog.go:999  [config] file created at: 2017/02/28 11:06:58
I170228 11:06:58.060465 1 util/log/clog.go:999  [config] running on machine: gzns-dba-sz-ndbtest-02
I170228 11:06:58.060465 1 util/log/clog.go:999  [config] binary: CockroachDB CCL beta-20170223 (linux amd64, built 2017/02/23 16:30:53, go1.7.5)
I170228 11:06:58.060465 1 util/log/clog.go:999  [config] arguments: [/home/work/setup-cockroachdb/bin//cockroach start --port=26257 --http-port=8080 --store=path=/ssd/newdb,attrs=ssd --join=gzns-dba-sz-ndbtest-01.gzns --join=gzns-dba-sz-ndbtest-02.gzns --join=gzns-dba-sz-ndbtest-03.gzns --join=gzns-dba-sz-ndbtest-04.gzns --cache=24G --attrs=gzns --insecure]

Here is the call stack:

panic: No span in context? Was resetForNewSQLTxn() called previously? [recovered]
        panic: SELECT timestamp, eventType, targetID, reportingID, info, uniqueID FROM system.eventlog WHERE true ORDER BY timestamp DESC LIMIT $1: No span in context? Was resetForNewSQLTxn() called previously?
        panic: session: unexpected leftover memory: 12190 bytes
goroutine 3338 [running]:
panic(0x196c140, 0xc420ed2150)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/cockroachdb/cockroach/pkg/sql/mon.(*MemoryMonitor).Stop(0xc421f819a0, 0x7f4ff95844a8, 0xc422b860c0)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/mon/mem_usage.go:339 +0x381
github.com/cockroachdb/cockroach/pkg/sql.(*Session).Finish(0xc421f80000, 0xc420444000)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/session.go:178 +0x99
panic(0x19ba540, 0xc420ed2120)
        /usr/local/go/src/runtime/panic.go:458 +0x243
github.com/cockroachdb/cockroach/pkg/sql.(*Executor).ExecuteStatements.func1(0xc421b34240, 0x83)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/executor.go:484 +0x149
panic(0x196c140, 0xc420ed20e0)
        /usr/local/go/src/runtime/panic.go:458 +0x243
github.com/cockroachdb/cockroach/pkg/sql.(*txnState).finishSQLTxn(0xc421f80068, 0x7f4ff95844a8, 0xc422b860c0)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/session.go:371 +0x26f
github.com/cockroachdb/cockroach/pkg/sql.(*Executor).execRequest(0xc420444000, 0xc421f80000, 0xc421b34240, 0x83, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/executor.go:742 +0xd45
github.com/cockroachdb/cockroach/pkg/sql.(*Executor).ExecuteStatements(0xc420444000, 0xc421f80000, 0xc421b34240, 0x83, 0xc422cfc758, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/cockroachdb/cockroach/pkg/sql/executor.go:490 +0x11f
github.com/cockroachdb/cockroach/pkg/server.(*adminServer).Events(0xc4204f2000, 0x7f4ff95843c8, 0xc420d3ad20, 0xc420ed4720, 0x0, 0x0, 0x0)
        /go/src/github.com/cockroachdb/cockroach/pkg/server/admin.go:706 +0x473

yznming avatar Feb 28 '17 06:02 yznming

@knz @andreimatei

a-robinson avatar Feb 28 '17 13:02 a-robinson

@yznming thanks for your report. Can you provide a bit more information about how you encountered this? Is there a list of steps we can follow to reproduce this issue?

(I can't seem to reproduce this on a freshly created cluster)

knz avatar Feb 28 '17 20:02 knz

@knz

  1. download the official release beta-20170223, and setup the cluster.
  2. Stop the cluster.
  3. Set the runtime variable as follow:
export COCKROACH_TRACE_SQL=30ms
  1. Start the cluster.
  2. Click the View node list in the admin UI: image

yznming avatar Mar 01 '17 09:03 yznming

This reproduces via: rm -fr cockroach-data && COCKROACH_TRACE_SQL=30ms roachdemo -n 3 -- --logtostderr

petermattis avatar Mar 01 '17 11:03 petermattis

Hey @yznming, thanks for the report. While we fix this, I'm curious - what are you using TRACE_SQL for? If you know the query you'd like to trace, I have some work in progress that might be better for you than the TRACE_SQL big hammer.

andreimatei avatar Mar 01 '17 15:03 andreimatei

(replying for @yznming because of time zone differences) They're benchmarking a single query (a simple INSERT, I think) and trying to hit very strict latency targets. They're seeing higher p99 latency than they'd like, so they want to use COCKROACH_TRACE_SQL to find what's going on when the query takes too long.

bdarnell avatar Mar 01 '17 20:03 bdarnell

@andreimatei @bdarnell yes, we are trying to trace the reason of query latency. We deploy a 8 nodes cluster with 5 replicas. We found that the SELECT query is far better than INSERT. (SELECT: 50K+ QPS; INSERT 10K QPS).

yznming avatar Mar 02 '17 02:03 yznming