Code Monkey home page Code Monkey logo

Comments (8)

thockin avatar thockin commented on September 25, 2024

It keeps happening - any clues on how to debug it would be helpful.

from delve.

aarzilli avatar aarzilli commented on September 25, 2024

Are you hitting ^Z while the program you are debugging is running or at delve's prompt?
If you look at the output of ps what does it say about dlv?
Can you use delve to attach to the stuck dlv process and see what it's doing?

from delve.

thockin avatar thockin commented on September 25, 2024

^Z while in dlv

 ps auxw | grep dlv
thockin  3468313  1.5  0.1 6322216 83956 pts/0   Tl+  15:07   0:00 dlv debug ./staging/src/k8s.io/code-generator/cmd/defaulter-gen -- --v 5 --logtostderr -h hack/boilerplate/boilerplate.generatego.txt -O zz_generated.defaults -i ./cmd/kubeadm/app/apis/kubeadm/v1beta3 -i ./cmd/kubeadm/app/apis/kubeadm/v1beta4 -i ./pkg/apis/abac/v1beta1 -i ./pkg/apis/admission/v1 
$ dlv attach 3468313
Could not attach to pid 3468313: this could be caused by a kernel security setting, try writing "0" to /proc/sys/kernel/yama/ptrace_scope

sudo ~thockin/go/bin/dlv attach 3468313
Type 'help' for list of commands.

(dlv) grs
  Goroutine 1 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/input.go:140 github.com/go-delve/liner.(*State).readNext (0x9537be) [select]
  Goroutine 2 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [force gc (idle) 1631637529423568]
  Goroutine 3 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [GC sweep wait]
  Goroutine 4 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [GC scavenge wait]
  Goroutine 5 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [finalizer wait 1631637529423568]
  Goroutine 6 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/pkg/proc/native/proc.go:400 github.com/go-delve/delve/pkg/proc/native.(*ptraceThread).handlePtraceFuncs (0x892457) [chan receive]
  Goroutine 7 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 13 - User: /home/thockin/sdk/gotip/src/net/pipe.go:159 net.(*pipe).read (0x565a35) [select]
  Goroutine 15 - User: /home/thockin/sdk/gotip/src/runtime/internal/syscall/syscall_linux.go:38 syscall.RawSyscall6 (0x407ced) (thread 3468317)
  Goroutine 18 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 19 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 20 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 21 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [select 1631637748260353]
  Goroutine 34 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 35 - User: /home/thockin/sdk/gotip/src/runtime/proc.go:403 runtime.gopark (0x44090e) [debug call]
  Goroutine 51 - User: /home/thockin/sdk/gotip/src/net/pipe.go:159 net.(*pipe).read (0x565a35) [select]
  Goroutine 53 - User: /home/thockin/sdk/gotip/src/runtime/sigqueue.go:152 os/signal.signal_recv (0x46f929) (thread 3468319)
  Goroutine 55 - User: /home/thockin/go/pkg/mod/github.com/go-delve/[email protected]/pkg/terminal/terminal.go:186 github.com/go-delve/delve/pkg/terminal.(*Term).sigintGuard (0x99f4bd) [chan receive 1631637748260353]
[18 goroutines]

Here's my config, in case it matters:

(dlv) config -list
aliases                   map[display:[disp] down:[do] help:[?]]
substitute-path           []
max-string-len            256
max-array-values          4
max-variable-recurse      2
disassemble-flavor        <not defined>
show-location-expr        false
source-list-line-color    "\x1b[0;33m"
source-list-arrow-color   "\x1b[1;36m"
source-list-keyword-color "\x1b[0;34m"
source-list-string-color  "\x1b[0;35m"
source-list-number-color  "\x1b[0;32m"
source-list-comment-color "\x1b[0;36m"
source-list-tab-color     "\x1b[2;37m"
source-list-line-count    10
debug-info-directories    [/usr/lib/debug/.build-id]
position                  ""
tab                       "... "
trace-show-timestamp      false

It seems to happen 100% now for me, but when I sud dlv attach'ed I could ^Z ok.

from delve.

aarzilli avatar aarzilli commented on September 25, 2024

The 'T' status looks fine, it means dlv did suspend in response to the signal. What's not good is the '+', at that point the shell should take over the terminal. What's the environment here: shell, terminal, any terminal multiplexes involved, ssh, is any of this being started by a script?

from delve.

thockin avatar thockin commented on September 25, 2024

from delve.

thockin avatar thockin commented on September 25, 2024

hah, that does seem to trigger it. I admit I don't know enough about how the terminal SHOULD react to say if this is right or not. I tested by putting vi in a script and ^Zing that works how I would expect (the whole shell suspends).

$ cat vi.sh 
#!/bin/sh
echo before
vi "$@"
echo after

$ echo $SHLVL
1

$ sh vi.sh /tmp/a
before
<vi loaded, I hit ^Z>
[1]+  Stopped                 sh vi.sh /tmp/a

$ echo $SHLVL
1

$ fg
<vi reloaded, I exited>
sh vi.sh /tmp/a
after

Is that a fair analog? I think so but not 100% sure.

from delve.

aarzilli avatar aarzilli commented on September 25, 2024

We're sending SIGTSTP to ourselves when we should be sending it to our process group. The workaround for this should be to have an actual exec in the script (exec dlv debug ...)

from delve.

thockin avatar thockin commented on September 25, 2024

Yes, exec fixes the problem for now. Thanks for digging in.

from delve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.