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

Can't attach to the container after exiting the current debug session #26

Closed
baodongli opened this issue Jan 10, 2018 · 8 comments
Closed
Assignees

Comments

@baodongli
Copy link

baodongli commented Jan 10, 2018

I am able to debug the microservice following the instructions. I got a few issues though:

  1. I issued 'exit' to the current debug session, but didn't kill the process. After 'dlv connect' to the same container, the process is no longer debuggable

  2. If I delete the current attachment, and attach to the container again, the attachment would show as in error.

squash --url=http://localhost:8001/api/v1/namespaces/squash/services/squash-server:http-squash-api/proxy/api/v2 debug-container docker.io/baodongli/microservice:0.1 example-microservice-rc-j68c7 example-microservice dlv
Debug config id: ONRhfKsUOH
squash --url=http://localhost:8001/api/v1/namespaces/squash/services/squash-server:http-squash-api/proxy/api/v2 list attachments 
State |ID         |Debugger |Image                                |Debugger Address
error |ONRhfKsUOH |dlv      |docker.io/baodongli/microservice:0.1 |
  1. After deleting/adding the microservice pod, sometimes, the 'wait' command returns timeout, and the 'list' command shows the attachment as 'none' state.
@baodongli
Copy link
Author

more info:

squash --url=http://localhost:8001/api/v1/namespaces/squash/services/squash-server:http-squash-api/proxy/api/v2 debug-container docker.io/baodongli/squash-demo:0.1 squash-demo-rc-db5rh squash-demo dlv
Debug config id: oF8iVdiJs5
devuser@c2-master:~/go/src/squash$ squash --url=http://localhost:8001/api/v1/namespaces/squash/services/squash-server:http-squash-api/proxy/api/v2 list attachments 
State |ID         |Debugger |Image                               |Debugger Address
none  |oF8iVdiJs5 |dlv      |docker.io/baodongli/squash-demo:0.1 |
devuser@c2-master:~/go/src/squash$ squash --url=http://localhost:8001/api/v1/namespaces/squash/services/squash-server:http-squash-api/proxy/api/v2 list attachments 
State |ID         |Debugger |Image                               |Debugger Address
none  |oF8iVdiJs5 |dlv      |docker.io/baodongli/squash-demo:0.1 |

@yuval-k
Copy link
Member

yuval-k commented Jan 11, 2018

Thanks for the feedback! will need to do some digging to understand the causes, and will update the ticket.

@yuval-k
Copy link
Member

yuval-k commented Jan 12, 2018

I'm writing automated e2e test for your scenario so should have updates in the next few days.

@baodongli
Copy link
Author

thanks. Just a little more info about the first issue:
exit and connect back, and get the following result:
devuser@c2-master:~/go/src/squash$ dlv connect localhost:38408
Handling connection for 38408
Type 'help' for list of commands.
(dlv) break /home/devuser/go/src/istio.io/istio/pilot/proxy/envoy/discovery.go:477
Command failed: no such process

My workaround is to kill the pods, delete the attach, restart the pods, attach again. It would be great if this can be fixed

@yuval-k yuval-k self-assigned this Jan 12, 2018
@yuval-k
Copy link
Member

yuval-k commented Jan 15, 2018

it seems like that from some reason dlv in server mode doesn't work very well with this use case of a client re-connecting (regardless of squash - i tested this with a bunch of terminals).

I'm going to implement a fix so that you will only need to delete the attachment and recreate it in order for it to work (i.e. no need to delete the pods).

@yuval-k
Copy link
Member

yuval-k commented Jan 30, 2018

I pushed the fix (as described in my previous comment) to master, so it will be out in the next release.

@pavius
Copy link
Contributor

pavius commented Jan 31, 2018

@yuval-k unsure if the same root cause, but I had a somewhat similar scenario that doesn't seem delve related.

  1. Successfully attached to a microservice
  2. Noticed I forgot to indicate dlv, so it attached gdb
  3. Tried to attach dlv - failed
  4. Deleted all attachments (list attachments returned an empty list)
  5. Tried to attach with dlv - failed
  6. Looked @ client logs, saw Already debugging pid. ignoring (
    log.WithField("pid", pid).Warn("Already debugging pid. ignoring")
    )
  7. Deleted attachment
  8. Recreated pod
  9. Re-ran on new pod - attached OK

@yuval-k
Copy link
Member

yuval-k commented Jan 31, 2018

Sounds like the same problem - should be resolved in our next release where deleting the attachment will automatically detach the debugger

@ilevine ilevine closed this as completed Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants