spenceforce / pdb-attach

A python debugger that can attach to running processes.
BSD 3-Clause "New" or "Revised" License
30 stars 1 forks source link

unable to detach #23

Closed tumble-weed closed 9 months ago

tumble-weed commented 1 year ago

hi, thanks for the great project. i am running ubuntu inside of docker. while i am able to attach to a running process, when i do detach, the attached process doesnt exit till i interrupt it using ctrl+c. it is unable to attach to the process again.

spenceforce commented 1 year ago

Hi @tumble-weed, it sounds like there's two issues you're running into.

  1. After calling detach, the process created with the command python -m pdb-attach ... is still running, but no longer communicating with the original process that you're trying to debug.
  2. Calling python -m pdb-attach ... again fails.

Is that a correct summary? Just want to make sure I understand correctly before debugging.

tumble-weed commented 1 year ago

thanks for the quick reply. here is the relevant code. the process i want to attach to (lets call this the target):

import pdb_attach
pdb_attach.listen(50000)  # Listen on port 50000.
import time
i = 0
while True:
    time.sleep(5)
    i+=1

the command i am using to attach ( assming pid is 506), lets call the attachment

python -m pdb_attach 506 50000

after calling detach, the attachment doesnt exit, and no longer communicates with the target. its like it is hung. hard exiting ( ctrl+c) makes it come out. however spawning another attachment seems to hang (i.e. fails but doesnt crash and exit).

spenceforce commented 1 year ago

Thanks for the clarification. I'll take a look at this and patch it up.

matt-bernstein commented 1 year ago

I am seeing the same issue. Also running ubuntu inside docker.

spenceforce commented 1 year ago

Sorry for the delay in fixing this. The past couple months have been hectic between a long distance move and major project deadlines at work. I have not forgotten about this though and will be returning my attention to it in July.