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

Debugger times out while the Bash shell is still going through the initialization #171

Open
dseynhae opened this issue Aug 25, 2022 · 1 comment

Comments

@dseynhae
Copy link

In addition to the details for issue, please provide us Executables information and Debug output unless you have confidence that they don't help us.

Executables

Version of bash-debug: v0.3.9

Output of following commands (on windows, execute them in Command Prompt or PowerShell):

where bash
C:\Windows\System32\bash.exe
code --version
code --version
1.70.2
e4503b30fc78200f846c62cf8091b76ff5547662
x64
bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
Linux dseynhae-MOBL1 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
---
/usr/bin/bash
/bin/bash
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
---
/bin/bash: bashdb: command not found
---
/usr/bin/cat
/bin/cat
cat (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.
---
/usr/bin/mkfifo
/bin/mkfifo
mkfifo (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
---
/usr/bin/pkill
/bin/pkill
pkill from procps-ng 3.3.16

Debug output

There is not output, the error window just pops up after 5 seconds.
Your launch.json may looks like:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "bashdb",
      "request": "launch",
      "showDebugOutput": true,
      "trace": true,
      "name": "Bash-Debug (simplest configuration)",
      "program": "${file}"
    }
  ]
}

Details

Debugger doesn't run:

image

I am pretty sure it is an issue with the timeout not being long enough (my bash shell takes about 5 seconds to start up):

  1. If I disable my init scripts, the debugger comes up.
  2. If I instrument my init scripts to produce a heartbeat into a file, I can tail -f this heartbeat. When I start the debugger, the heartbeat shows that we go through the full initialization. But before we reach the end, the error message pops up.
  3. I simplified the .bashrc to a sleep command. 4 seconds and below consistently gets the debugger to work; 5 seconds and above fails, and the error dialog comes up after exactly 5 seconds.

Note: Python used to have the same problem. They resolved it by making the timeout configurable in the launch.json configuration.

@dseynhae
Copy link
Author

For the script I'm debugging right now, I can just disable my initialization. In my .bashrc, I return immediately if the Bash shell is invoked by the VS Code debugging environment:

# Don't run initialization when running in VS Code Debugger
if env | grep -q VSCODE_HANDLES; then
        return 1
fi

I would prefer to be able to increase the "timeout" in my launch.json configuration though...

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

1 participant