question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use SIGTERM instead of SIGKILL when ending processes, allow attachSimplePort=0

See original GitHub issue

Describe the bug

(Note sure if bug or feature request is most appropriate, this might be a somewhat special case!)

wskdebug is a debugging tool for Apache Openwhisk (a serverless platform), which starts a container with a nodejs process inside that will have the actual debug port to which the VS Code debugger should connect. I am using this in VS Code as runtimeExecutable and have been intercepting the --inspect-brk=NNNN argument that was set by the previous debugger to use this port on the container that gets started. VS Code then did connect to the container, which was great.

However, it seems the new debugger uses a different mechanism. Apparently it sets NODE_OPTIONS with a --require that loads a JS file into the node process that apparently sets up the debugging from “inside” the process.

The problem is that now it debugs the wskdebug “intermediary” and not the target container.

Is there a way in the new debugger I can disable that and just get hold off the port number (which VS code randomly chooses, i.e. in case there are multiple debug sessions going on)?

See also https://github.com/apache/openwhisk-wskdebug/issues/74

On a related note, the new debugger seems to kill the process at the end immediately (SIGKILL style). The previous debugger sent a SIGTERM so that the process had a chance to cleanup and properly exit. In wskdebug case this is used to stop the docker container amongst other things. With the new debugger this is no longer possible and thus the container with the open debug port is left behind, so that the next run usually fails with “debug port already in use”. This is also an artifact of the above issue since always the same default debug port (9229) is picked now since --inspect-brk=NNNN with a unique port NNNN is missing.

To Reproduce Steps to reproduce the behavior:

  1. Run launch config with wskdebug as described here
  2. Notice debugger connects to wskdebug itself, but not the container it starts
  3. Cannot hit any breakpoints since it’s debugging the wrong process

Log File

vscode-debugadapter-9.json.gz

VS Code Version: 1.47.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
connor4312commented, Aug 25, 2020

Yep, they are

1reaction
connor4312commented, Jul 16, 2020

The nightly where --inspect-brk will not be filtered is today’s nightly, which will be available in about two hours from now 🙂

The change you want in your launch.json is

{
  "type": "pwa-node", // if only "node", VS Code will complain
  "request": "launch",
  "name": "My launch",
+ "attachSimplePort": 9229,
Read more comments on GitHub >

github_iconTop Results From Across the Web

SIGTERM vs SIGKILL: What's the Difference? - Linux Handbook
Both SIGTERM and SIGKILL are used for killing a process in Linux. But you should prefer using SIGTERM. Here's why!
Read more >
kill - End a process or job, or send it a signal - IBM
kill ends a process by sending it a signal. The default signal is SIGTERM. kill is a built-in shell command. In the tcsh...
Read more >
SIGINT And Other Termination Signals in Linux - Baeldung
In Linux systems, processes can receive a variety of termination signals, ... We should use SIGTERM, SIGQUIT, or SIGKILL instead.
Read more >
Allow process to finish rather than be interrupted when ...
I am developing some code which I need to gracefully shutdown when a sigterm signal is sent from the command line in ...
Read more >
Termination Signals (The GNU C Library)
The (obvious) default action for all of these signals is to cause the process to terminate. Macro: int SIGTERM ¶. The SIGTERM signal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found