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

Start without debugging hangs after process exits #36235

Closed
oliversturm opened this issue Oct 13, 2017 · 7 comments
Closed

Start without debugging hangs after process exits #36235

oliversturm opened this issue Oct 13, 2017 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@oliversturm
Copy link

oliversturm commented Oct 13, 2017

VSCode Version: Code 1.17.0 (be377c0, 2017-10-04T23:33:45.303Z)
OS Version: Linux x64 4.8.0-59-generic

I have this launch configuration. It was created by one of the standard templates, I just changed the final arg to ${file}:

{
  "type": "node",
  "request": "launch",
  "name": "Current Mocha test file",
  "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
  "args": ["-u", "tdd", "--timeout", "999999", "--colors", "${file}"],
  "internalConsoleOptions": "openOnSessionStart"
}

I select this from the popup list in the debug panel, then hit F5 - my tests run through without issues. I can see the debugger control toolbar pop up and then go away when the tests are done.

When I use Ctrl-F5 to run my tests without debugging, everything still runs through without any issues, the debug console shows the same output from my tests but not the lines starting "debugger listening" and "debugger attached" - so it looks like all is good. However, the debugger control toolbar doesn't go away when the tests are done and I have to stop the process manually by clicking the stop button in that toolbar.

I tried running the command from the console:

node node_modules/mocha/bin/_mocha -u tdd --timeout 999999 --colors myfile.test.js

It runs through and ends without any trouble. I would like code to do that, too...

@vscodebot vscodebot bot added the debug Debug viewlet, configurations, breakpoints, adapter issues label Oct 13, 2017
@isidorn
Copy link
Contributor

isidorn commented Oct 13, 2017

This might be a long running bug of node not terminating. Though assigning to @weinand to asses this further

@oliversturm as a workaround you can try using protocol: inspector in your launch.json or upgrading to the latest version of node.

@isidorn isidorn assigned weinand and unassigned isidorn Oct 13, 2017
@oliversturm
Copy link
Author

@isidorn I guess you know what you're talking about, but node seems to terminate just fine when run from the command line or with the debugger attached. I'm on node v8.4.0 at the moment.

@oliversturm
Copy link
Author

I updated to node v8.7.0 but the problem remains the same.

@isidorn
Copy link
Contributor

isidorn commented Oct 16, 2017

I noticed that on the vscode side sometimes I am not getting a 'terminated' or 'exit' event from the adapter when running 'start without debugging'. For example for this javascript sample (sorry for the ugly sample)
@oliversturm if you have some minimalistic sample for which you can always reproduce this it would be great. Since it is not always happening, at least to me

function fib(n) { if ((n === 1) || (n === 0)) { return 1; } else { return fib(n - 1) + fib(n - 2); } }




var t = {
	hello: "adsdaddssss",
	second: true,
	third: 5
} // asdlkjasdlkjaslkd jasdjlasdj
// console.log('daslasdljklakdsjkljasdkjlasdkjldalkjdaskljdaskljdaskljasddlaskjdlaskjdalskjdaslkjasdljaslkdjalsjlasdjldasjldkjasldjaslkdjaslkdjlsajdlkasjdlasjdlkasjldjasldjasldjasljldaslasdljklakdsjkljasdkjlasdkjldalkjdaskljdaskljdaskljasddlaskjdlaskjdalskjdaslkjasdljaslkdjalsjlasdjldasjldkjasldjaslkdjaslkdjlsajdlkasjdlasjdlkasjldjasldjasldjasljldaslasdljklakdsjkljasdkjlasdkjldalkjdaskljdaskljdaskljasddlaskjdlaskjdalskjdaslkjasdljaslkdjalsjlasdjldasjldkjasldjaslkdjaslkdjlsajdlkasjdlasjdlkasjldjasldjasldjasljldaslasdljklakdsjkljasdkjlasdkjldalkjdaskljdaskljdaskljasddlaskjdlaskjdalskjdaslkjasdljaslkdjalsjlasdjldasjldkjasldjaslkdjaslkdjlsajdlkasjdlasjdlkasjldjasldjasldjasljldaslasdljklakdsjkljasdkjlasdkjldalkjdaskljdaskljdaskljasddlaskjdlaskjdalskjdaslkjasdljaslkdjalsjlasdjldasjldkjasldjaslkdjaslkdjlsajdlkasjdlasjdlkasjldjasldjasldjasljl')

"C:\Users\User";
console.log('/Users/isidor/Development/w/standup/fib.js');
console.log('server/test.ts');
var t = 'C:\\Users\\User';
var x1 = 9; x1 = 10;
// console.log(msg);
// https://www.google.com
// sdadsasad sdadas dsadasdsa ddassd
var text = "some text";
var t = {
	hello: "asdads"
}
var o = {};
o['hello world'] = 123;
debugger;
var t = 5 / 0;
var m = [];




console.log(['hello', 'world']);
setTimeout(function () {
}, 0);
myLongString
var m = 2 / 0;
var t = "{\nisidor}"; var m = 5; console.log('hello');
let longString = new Array(10001).join('oooooo ');
longString += '<END>';
$isidor


if (true) {
	let longString = 5;
	console.log(longString);
}

// console.log(longString);1

console.log({ foo: "bar" });

var myObject = {
	a: 1,
	b: 2,
	c: 3
}

setInterval(() => {
	// console.log('asdadsads')
}, 500);

var myMap = new Map();
var $isidor = 5;

var keyString = "a string",
	keyObj = {},
	keyFunc = function () { };

// setting the values
myMap.set(keyString, "value associated with 'a string'");
myMap.set(keyObj, "value associated with keyObj");
myMap.set(keyFunc, "value associated with keyFunc");




for (var i = 0; i < 100000; i++) {
	myMap.set(i, "this is entry with: " + i);
}

var text = "    lots     of   whitespace   "

var aLargeArray = []
for (var i = 0; i < 5000; i++) {
	aLargeArray.push(i);
}



var myLongString = "This is a very very very long string that is from the december VSCode release nicely wrapped in the debug console for better visibility.This is a very very very long string that is from the december VSCode release nicely wrapped in the debug console for better visibility.Thi.";
console.log(myLongString)
var c = console;
var t8 = 5;

@oliversturm
Copy link
Author

@isidorn The problem seems easy to reproduce for me. My launch configuration is in the initial post, and I just tried whether it depends on the test - it doesn't. I can repro with this test code:

const { describe, it } = require('mocha');
const assert = require('chai').assert;

describe('barg', function() {
  it('argh', function() {
    assert(42 === 6 * 7, 'oh noes');
  });
});

I'm using mocha 4.0.1 and chai 4.2.1. Node still 8.7.0. I guess that's it... can you see the same?

@oliversturm
Copy link
Author

Oh well - it struck me as stupid to leave chai in there, so I changed to const assert = require('assert') and the problem remains the same.

@roblourens
Copy link
Member

roblourens commented Oct 16, 2017

Yeah this is easy to repro - until recently, we actually couldn't detect when the Node process was finished, when a debugger was attached. When that was hooked up, I didn't fix this noDebug case. Thanks for the report.

@roblourens roblourens added the bug Issue identified by VS Code Team member as probable bug label Oct 16, 2017
@roblourens roblourens added this to the October 2017 milestone Oct 16, 2017
@mjbvz mjbvz added the verified Verification succeeded label Nov 3, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants