vscode: Insiders failed to launch for test run using vscode-test ("Could not delete obsolete instance handle" - sock file missing?)

I don’t have repro steps for this (nor do I know how common it is), but it seems like this came up in #81652 but the issue was closed by the bot and it doesn’t seem like it was addressed.

I’m running tests on GitHub Actions - this one using macOS. I use vscode-test to run the tests like this:

const res = await vstest.runTests({
	extensionDevelopmentPath: cwd,
	extensionTestsEnv: { ...testEnv, ...env },
	extensionTestsPath: path.join(cwd, "out", "src", "test", testFolder),
	launchArgs: [
		path.isAbsolute(workspaceFolder)
			? workspaceFolder
			: path.join(cwd, "src", "test", "test_projects", workspaceFolder),
		"--user-data-dir",
		path.join(cwd, ".dart_code_test_data_dir"),
	],
	version: process.env.CODE_VERSION,
});

This is called multiple times with different testFolder and workspaceFolder params. One test run was fine, but then I got this error (which then repeated for every subsequent invocation in the same way):

2019-12-05T09:17:37.8141490Z   test environment
2019-12-05T09:17:37.8146740Z 
2019-12-05T09:17:37.8147990Z     ✓ has opened the correct folder
2019-12-05T09:17:37.8150710Z 
2019-12-05T09:17:37.8151900Z   3 passing (6s)
2019-12-05T09:17:37.8152370Z 
2019-12-05T09:17:37.8158840Z Test run is complete! Calling VS Code callback with (null, 0)
2019-12-05T09:17:37.8173710Z 
2019-12-05T09:17:40.8880150Z Exit code:   0
2019-12-05T09:17:40.8880790Z Done
2019-12-05T09:17:40.8881040Z 
2019-12-05T09:17:40.8881520Z ############################################################
2019-12-05T09:17:40.8881740Z 
2019-12-05T09:17:40.8881870Z 
2019-12-05T09:17:40.8882050Z 
2019-12-05T09:17:40.8882550Z Running not_activated/dart_create tests folder in workspace empty
2019-12-05T09:17:40.8884650Z Attempting to download VS Code attempt #1
2019-12-05T09:17:41.1385550Z Found .vscode-test/vscode-1.40.2. Skipping download.
2019-12-05T09:17:41.1386330Z Running tests with pre-downloaded VS Code
2019-12-05T09:17:41.6285570Z Found .vscode-test/vscode-insiders matching latest Insiders release. Skipping download.
2019-12-05T09:17:42.0750980Z [main 2019-12-05T09:17:42.070Z] Could not delete obsolete instance handle Error: ENOENT: no such file or directory, unlink '/Users/runner/runners/2.162.0/work/Dart-Code/Dart-Code/.dart_code_test_data_dir/1.41.0-insider-main.sock'
2019-12-05T09:17:42.0751790Z     at Object.unlinkSync (original-fs.js:976:3)
2019-12-05T09:17:42.0752680Z     at Object.doStartup (/Users/runner/runners/2.162.0/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/electron-main/main.js:551:165)
2019-12-05T09:17:42.0752980Z     at processTicksAndRejections (internal/process/task_queues.js:89:5) {
2019-12-05T09:17:42.0753490Z   errno: -2,
2019-12-05T09:17:42.0754000Z   syscall: 'unlink',
2019-12-05T09:17:42.0754680Z   code: 'ENOENT',
2019-12-05T09:17:42.0755420Z   path: '/Users/runner/runners/2.162.0/work/Dart-Code/Dart-Code/.dart_code_test_data_dir/1.41.0-insider-main.sock'
2019-12-05T09:17:42.0755680Z }
2019-12-05T09:17:42.0755760Z 
2019-12-05T09:17:42.0757390Z [main 2019-12-05T09:17:42.075Z] Error: ENOENT: no such file or directory, unlink '/Users/runner/runners/2.162.0/work/Dart-Code/Dart-Code/.dart_code_test_data_dir/1.41.0-insider-main.sock'
2019-12-05T09:17:42.0758040Z     at Object.unlinkSync (original-fs.js:976:3)
2019-12-05T09:17:42.0758900Z     at Object.doStartup (/Users/runner/runners/2.162.0/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/electron-main/main.js:551:165)
2019-12-05T09:17:42.0759230Z     at processTicksAndRejections (internal/process/task_queues.js:89:5)
2019-12-05T09:17:42.0759320Z 
2019-12-05T09:17:42.0884930Z Exit code:   1
2019-12-05T09:17:42.0886770Z Done
2019-12-05T09:17:42.0886940Z 
2019-12-05T09:17:42.0894300Z Failed
2019-12-05T09:17:42.0894790Z ############################################################
2019-12-05T09:17:42.0918950Z 

Is this something VS Code can recover better from? It’s particularly bad on GitHub Actions where it’s not possible to re-run individual steps (so I have to re-run a whole 1-hour run to retry this) - though I appreciate that’s hardly VS Code’s fault 😃

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (26 by maintainers)

Commits related to this issue

Most upvoted comments

For me this is easy to repro. I can investigate more if someone can point me towards where these socket files are created and if you know why their path lengths might be limited. Seems like the path length is limited to 103 characters.

mkdir -p /tmp/aaaaaaaa/bbbbbbbbbbbbb/cccccccccccccccc/dddddddddddddddd/eeeeeeeeeeeeeee/fffffffffffffffff/gggggggggggggggggg/hhhhhhhhhhhhhhhhh/iiiiiiiiiiiiiii
code-insiders --user-data-dir /tmp/aaaaaaaa/bbbbbbbbbbbbb/cccccccccccccccc/dddddddddddddddd/eeeeeeeeeeeeeee/fffffffffffffffff/gggggggggggggggggg/hhhhhhhhhhhhhhhhh/iiiiiiiiiiiiiii # works
# same command again with --verbose, produces the error

ls -l /tmp/aaaaaaaa/bbbbbbbbbbbbb/cccccccccccccccc/dddddddddddddddd/eeeeeeeeeeeeeee/fffffffffffffffff/ggggggg

srwxr-xr-x  1 roblou  wheel  0 Mar  2 20:40 /tmp/aaaaaaaa/bbbbbbbbbbbbb/cccccccccccccccc/dddddddddddddddd/eeeeeeeeeeeeeee/fffffffffffffffff/ggggggg

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

Unfortunately I cannot afford to spend a day investigating an obscure user CI issue

That’s disappointing. This is not an obscure user CI issue, it’s a tiny trivial repro I built specifically to shows the issue in VS Code or vscode-test. There is almost zero code written by me above. vscode-test is invoked twice and the second time, VS Code fails to start up with an error. The repro really couldn’t be any simpler - I even set it up on GH Actions so it was trivial for you to repro (there was a suggestion above about running from source which I don’t know how to do) and to avoid any issues with it being someone elses CI system.

And FWIW, I’ve spent significant time (easily in the order of a large number of weeks) building repro cases for VS Code bugs. My GitHub account has 28 repositories containing ‘vscode’ where I’ve built full extension repros, and there are countless issues where I’ve provided code samples in issues.

Unfortunately I cannot afford to spend a day investigating an obscure user CI issue, surely you can understand. I’m more than happy to give you a general direction on where to look.

In any case, I would still write some code that checks for that folder’s existence once runTests throws.

I don’t think this is specific to vscode-test, but launching VS Code in general. @joaomoreno you are assigned for the other issue as well, do you have any insights?