Closed adzfolc closed 1 year ago
Hello, I am Blathers. I am here to help you get the issue triaged.
Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.
I have CC'd a few people who may be able to assist you:
If we have not gotten back to your issue within a few business days, you can try the following:
:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.
After re-compile server by executing ./dev build cockroach
via bazel, I can print debug keys successfully now.
ps: I used to compile server by executing make build
, which can't print debug keys successfully.
make
is deprecated, dev
is the way to build cockroach nowadays.
@yuzefovich Hi,I'm not familiar with Bazel, and while I pull latest code from master, I can't debug crdb now with goland.Is there any toturial about how to debug crdb builded by bazel in goland?
./cockroach version
Build Tag: v23.1.0-alpha.1-1527-gdc32242213-dirty
Build Time: 2023/02/02 02:48:02
Distribution: CCL
Platform: darwin arm64 (arm64-apple-darwin22.3.0)
Go Version: go1.19.4
C Compiler: Apple LLVM 14.0.0 (clang-1400.0.29.202)
Build Commit ID: dc3224221324dcc4336861232003f2ec1aac4f9c
Build Type: development
And following is my goland bazel conf.Is there anything wrong with my conf?
Try ./dev gen go
- this should generate some of the code and put it where Goland expects it.
Thx for reply, I've executed several cmds as ./dev -h
, like ./dev gen bazel
, ./dev gen go
.
And, truly I can start crdb server via goland, and bazel conf is like screen shoot like above.
The run banner is grey, and I can't activate it, while run banner is green, and I can run crdb server in goland.
Can u help me with how to debug crdb in goland?
I'm assuming that you're trying to run CRDB via a debugger in GoLand, right? Here is an example of how I run a single node cockroach cluster via the debugger:
Note that it's not running a "bazel" command - it's a "regular" go
run. (This is after ./dev gen go
.)
I'm assuming that you're trying to run CRDB via a debugger in GoLand, right? Here is an example of how I run a single node cockroach cluster via the debugger: Note that it's not running a "bazel" command - it's a "regular"
go
run. (This is after./dev gen go
.)
After configure as above, I push run banner, and meet another problem,
# github.com/knz/strtime
gmtime_r.c:47:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
# github.com/cockroachdb/cockroach/pkg/cmd/cockroach
panic: unexpected 32-bit segment
goroutine 1 [running]:
cmd/link/internal/ld.machoCombineDwarf(0x105205a08?, 0x1401bb78150?, 0x1400071c180, {0x14015704820?, 0x1?}, {0x14027bc4000, 0x53})
/opt/homebrew/Cellar/go/1.19.5/libexec/src/cmd/link/internal/ld/macho_combine_dwarf.go:218 +0xfb4
cmd/link/internal/ld.(*Link).hostlink(0x14000148000)
/opt/homebrew/Cellar/go/1.19.5/libexec/src/cmd/link/internal/ld/lib.go:1830 +0x4540
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x10513c842, 0x14}, {0x1051401ad, ...}, ...})
/opt/homebrew/Cellar/go/1.19.5/libexec/src/cmd/link/internal/ld/main.go:378 +0x1444
main.main()
/opt/homebrew/Cellar/go/1.19.5/libexec/src/cmd/link/main.go:72 +0xd98
Compilation finished with exit code 2
➜ cockroach git:(master) ✗ go version
go version go1.19.5 darwin/arm64
➜ cockroach git:(master) ✗ ./cockroach version
Build Tag: v23.1.0-alpha.1-1527-gdc32242213-dirty
Build Time: 2023/02/02 02:48:02
Distribution: CCL
Platform: darwin arm64 (arm64-apple-darwin22.3.0)
Go Version: go1.19.4
C Compiler: Apple LLVM 14.0.0 (clang-1400.0.29.202)
Build Commit ID: dc3224221324dcc4336861232003f2ec1aac4f9c
Build Type: development
My go version is go1.19.5
, and ./cockroach version
shows go version is go1.19.4
.Is there any relationship between error above and go version diff?
Huh, I've never seen an error like this before. It might be related to go version so consider downgrading to 1.19.4. Also, consider running rm -rf vendor
if you have ./vendor
folder (we recently removed the old way we vendored dependencies, and the old folder might be interfering with the build although it seems unlikely). Otherwise, I'm out of ideas.
Huh, I've never seen an error like this before. It might be related to go version so consider downgrading to 1.19.4. Also, consider running
rm -rf vendor
if you have./vendor
folder (we recently removed the old way we vendored dependencies, and the old folder might be interfering with the build although it seems unlikely). Otherwise, I'm out of ideas.
I think I'm close to the end of the problem. Now, I've done things as following:
➜ ~ go version
go version go1.19.4 darwin/arm64
➜ cockroach git:(master) ✗ ./cockroach version
Build Tag: v23.1.0-alpha.1-1527-gdc32242213
Build Time: 2023/02/02 06:09:47
Distribution: CCL
Platform: darwin arm64 (arm64-apple-darwin22.3.0)
Go Version: go1.19.4
C Compiler: Apple LLVM 14.0.0 (clang-1400.0.29.202)
Build Commit ID: dc3224221324dcc4336861232003f2ec1aac4f9c
Build Type: development
➜ cockroach git:(master) ✗ ./cockroach-short start-single-node --listen-addr=127.0.0.1:26257 --http-addr=127.0.0.1:8081 --store /Users/adzfolc/Workspace/crdbdata --insecure
*
* WARNING: ALL SECURITY CONTROLS HAVE BEEN DISABLED!
*
* This mode is intended for non-production testing only.
*
* In this mode:
* - Your cluster is open to any client that can access 127.0.0.1.
* - Intruders with access to your machine or network can observe client-server traffic.
* - Intruders can log in without password and read or write any data in the cluster.
* - Intruders can consume all your server's resources and cause unavailability.
*
*
* INFO: To start a secure server without mandating TLS for clients,
* consider --accept-sql-without-tls instead. For other options, see:
*
* - https://go.crdb.dev/issue-v/53404/v23.1
* - https://www.cockroachlabs.com/docs/v23.1/secure-a-cluster.html
*
*
* WARNING: Running a server without --sql-addr, with a combined RPC/SQL listener, is deprecated.
* This feature will be removed in the next version of CockroachDB.
*
CockroachDB node starting at 2023-02-02 07:41:00.234675 +0000 UTC m=+1.422750626 (took 1.2s)
build: CCL v23.1.0-alpha.1-1527-gdc32242213 @ 2023/02/02 06:09:47 (go1.19.4)
webui: http://127.0.0.1:8081
sql: postgresql://root@127.0.0.1:26257/defaultdb?sslmode=disable
sql (JDBC): jdbc:postgresql://127.0.0.1:26257/defaultdb?sslmode=disable&user=root
RPC client flags: ./cockroach-short <client cmd> --host=127.0.0.1:26257 --insecure
logs: /Users/adzfolc/Workspace/crdbdata/logs
temp dir: /Users/adzfolc/Workspace/crdbdata/cockroach-temp4084431707
external I/O path: /Users/adzfolc/Workspace/crdbdata/extern
store[0]: path=/Users/adzfolc/Workspace/crdbdata
storage engine: pebble
clusterID: 4413793c-7314-486c-98c6-8253b2bb6ac9
status: restarted pre-existing node
nodeID: 1
^CNote: a second interrupt will skip graceful shutdown and terminate forcefully
initiating graceful shutdown of server
server drained and shutdown completed
*
* INFO: interrupted
*
ERROR: interrupted
Failed running "start-single-node"
However, in GoLand, I start server via Go Build
, conf is like ur screen shoot.
And, when I debug, server starts failed:
GOROOT=/usr/local/go #gosetup
GOPATH=/Users/adzfolc/go #gosetup
/usr/local/go/bin/go build -o /private/var/folders/7k/lh4pzfn52pzc6bg_n40__4l40000gn/T/GoLand/___1crdb -gcflags all=-N -l . #gosetup
# github.com/knz/strtime
gmtime_r.c:47:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
# github.com/cockroachdb/cockroach/pkg/cmd/cockroach
panic: unexpected 32-bit segment
goroutine 1 [running]:
cmd/link/internal/ld.machoCombineDwarf(0x104bc9a08?, 0x140000a6300?, 0x14000a14080, {0x1400b705220?, 0x1?}, {0x14010c90c60, 0x53})
/usr/local/go/src/cmd/link/internal/ld/macho_combine_dwarf.go:218 +0xfb4
cmd/link/internal/ld.(*Link).hostlink(0x14000104000)
/usr/local/go/src/cmd/link/internal/ld/lib.go:1830 +0x4540
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x104b00802, 0x14}, {0x104b0416d, ...}, ...})
/usr/local/go/src/cmd/link/internal/ld/main.go:378 +0x1444
main.main()
/usr/local/go/src/cmd/link/main.go:72 +0xd98
Compilation finished with exit code 2
Err comes from code as below
What hardware and OS are you running on?
HardWare: arm64 CPU: Apple M1 Max OS: macOS 13.2 (22D49)
I still could debug crdb via goland about 1 week ago(at Jan 29, still with Makefile), and after pulling code(about several days ago) from switching to bazel, I can't debug now.
Not sure what the issue is, I'll ask my colleagues to look into this.
In addition, I'm great interested in db, and I'm familiar with sql parser, analyzer; txn xa protocol and know sth about consensus algo(know paxos and new to raft).Recently, I'm learning crdb cdc(rangefeed) and sth about distributed layer(meta 1/2 and ranges merge/split). Can I get enrolled in crdb development from some trival problems? I'm not sure how to contact you is reasonable, I'm available at mail(adzfolc@gmail.com) and CockroachDB Community Slack(username adzfolc). And I'm very very willing to participate in crdb contribution as a community member. Wish U A Goo Day! LOL~ :D
One my colleagues suggested that it must be a bug in Go linker, so you should file an issue upstream with the reproduction steps.
In terms of contributing, take a look at #41815 for some guidance.
Putting the content build --force_build_cdeps
in a .bazelrc.user
file in your checkout and then re-running ./dev gen go
may fix the problem, I am not sure.
One my colleagues suggested that it must be a bug in Go linker, so you should file an issue upstream with the reproduction steps.
In terms of contributing, take a look at #41815 for some guidance.
I've report this proble to go upstream. And issue to track is linked to https://github.com/golang/go/issues/58330
Putting the content
build --force_build_cdeps
in a.bazelrc.user
file in your checkout and then re-running./dev gen go
may fix the problem, I am not sure.
I tried and failed. I guess that build --force_build_cdeps
has same effect like ./dev gen cgo
?
After re-init my Mac for several times, and re-install dev chain, finally I can debug now.Thanks for your help!
Describe the problem
Failed to print values by executing
cockroach debug keys path --values
To Reproduce
1.Clone master branch, build and start local single server I'm now at commit
* 69dd453d0e (HEAD -> master, upstream/master, origin/master, origin/HEAD) Merge #95658
2.Create a test table and insert some data 3.Execue command./cockroach debug keys /Users/adzfolc/Workspace/crdbdata/26257 --values
4.Crash reportExpected behavior I expect that debug keys should be printed.
Additional data / screenshots 1.Dev Env Mac OS 13.2 (22D49) go version go1.19.5 darwin/arm64 2.Prepare for some test data
3.Here is some log printed when server starts which may can help.
If applicable, add screenshots to help explain your problem.
Environment:
cockroach sql
]Additional context What was the impact?
Add any other context about the problem here.
Jira issue: CRDB-23966