linter-shellcheck
linter-shellcheck copied to clipboard
Process execution timed out
I continually get this error in the console randomly. ShellCheck will work fine for a while, then randomly start throwing this. Restarting Atom usually fixes it for a bit. Running ShellCheck from terminal works fine.
[Linter] Error running ShellCheck Error: Process execution timed out at /home/myusername/.atom/packages/linter-shellcheck/node_modules/sb-exec/lib/index.js:89 (anonymous) @ linter-registry.js [sm]:137
Never had this issue until I upgraded Ubuntu to 20.04 LTS
Now I confirm I am also affected with these versions:
- linter-shellcheck 1.6.0
- Atom 1.47.0
- shellcheck 0.7.0
/home/myusername/.atom/packages/linter/lib/linter-registry.js:154 [Linter] Error running ShellCheck Error: Process execution timed out
at /home/myusername/.atom/packages/linter-shellcheck/node_modules/sb-exec/lib/index.js:89
Found how to fix:
- Go to
Packages / Linter Shellcheck
settings. - Fill the
Timeout
field with any large enough value orInfinity
.
The linter-shellcheck/node_modules/sb-exec/lib/index.js
would need a decent fall-back default when the options.timeout
is not set here:
See: steelbrain/exec
lines 97-103
if (options.timeout !== Infinity) {
timeout = setTimeout(function () {
// eslint-disable-next-line no-use-before-define
killProcess(spawnedProcess);
reject(new Error('Process execution timed out'));
}, options.timeout);
}
Related: https://github.com/steelbrain/exec/issues/101
Hi! Having same timeout issue but didn't see any settings to configure it ...
Atom 1.48.0 on Ubuntu
Hi,
I also did not see the settings to configure that value.
However, a workaround is to modify the value of the variable timeout directly.
On my system it can be done here:
~/.atom/packages/linter-shellcheck/node_modules/sb-exec/lib/helper.js
Comment out the lines including
if (options.timeout) {
(0, _assert2.default)(typeof options.timeout === 'number', 'options.timeout must be a number');
} else options.timeout = Infinity;
and insert
option.timeout = Infinity;
Setting the timeout to infinity sounds like it would leave random processes running on the system.
The issue seems to be that the input to shellcheck is not terminated and shellcheck hangs waiting for the rest. This only happens when the file is unsaved. Pressing ctrl-s, first of all stops the already running shellcheck, then re-runs shellcheck which returns a result pretty much immediately. Repeatedly pressing ctrl-s after that results in the same correct behaviour. Typing a single space on the other hand and not saving results in shellcheck hanging.
bump!
Ok, this is as far as I could get and maybe I am even looking in the wrong place, but...
It seems that the spawned process is never provided with any data on stdin. In this file the options are passed to the spawn function but the stdin
option is never used.
Also I have no idea where this file originally comes from. The debugger does not give me any info where it lies on the filesystem. Looks like one of the nodejs files. Also note that the there are two files involved with the same name. Those are different. 1
in the following screenshot is the unknown file. 2
seems to be a version of one of the files from nodejs. 1
is an older version of the same file?? Why would I have two versions of nodejs in Atom though?
I'm honestly tangled in a spaghetti of code here so if anyone else has an idea, please chime in :)
I've had the same issue on Linux, but my Mac setup worked fine.
In gathering all of the dependent environment versions for Linux trouble shooting, I discovered due to previous problem (unrelated? I've forgotten), I had disabled linter-ui-default. Today, I re-enabled linter-ui-default and my setup works again on saving any Shell Script file type in Atom, but it doesn't work during typing:
$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=20
DISTRIB_CODENAME=ulyana
DISTRIB_DESCRIPTION="Linux Mint 20 Ulyana"
$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.7.1
license: GNU General Public License, version 3
website: https://www.shellcheck.net
$ atom -v
Atom : 1.48.0
Electron: 5.0.13
Chrome : 73.0.3683.121
Node : 12.0.0
$ apm list | grep -e shell -e lint
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] (disabled)
├── [email protected]
I use the Linuxbrew install of shellcheck and I re-configured the linter-shellcheck package as follows:
- [checkbox on] Enable notice messages
- Executable path: /home/linuxbrew/.linuxbrew/bin/shellcheck
- [unchecked] Run shellcheck relative
- Additional executable params: --external-sources
~/.atom/packages/linter-shellcheck/node_modules/sb-exec/lib/helper.js
@d-hr I believe you had a typo, but I found that file is plural and ends in 's', i.e.:
~/.atom/packages/linter-shellcheck/node_modules/sb-exec/lib/helpers.js
I have the same issue on Arch Linux with:
- linter-shellcheck 16.0
- Atom 1.58.0
- shellcheck 0.7.2
I fixed it by editing this line in atom-linter/lib/helpers.js
const spawned = callback(filePath, parameters, Object.assign({ timeout: 10000 }, options))
is now:
const spawned = callback(filePath, parameters, Object.assign({ timeout: Infinity }, options))
That seems to work so far, I have no clue why though. Note that the edit was made in the file after it had gone through babel so the line number in the "babeled" version is 105.
The file can be found in ~/.atom/packages/linter-shellcheck/node_modules/atom-linter/lib/helpers.js
.
After a bit of digging, it appears that addind a uniqueKey
option to the command parser solves the issue.
const options = { stdin: text, cwd, ignoreExitCode: true, uniqueKey:`ShellCheck:${filePath}` };
in https://github.com/AtomLinter/linter-shellcheck/blob/d29c89062af89705269ae98077438565572061cf/lib/main.js#L77
Got the idea from there: https://github.com/steelbrain/atom-linter#unique-spawning
Not quite fixed actually, although it seems better. There seems to be a process that doesn't get any text input from stdin and causes the timeout function to raise an exception. More on this later...
This error now occurs repeatedly as soon as I start editing a shell script, rendering the package unusable for me.
Shellcheck 0.8.0 linter-shellcheck 1.6.0
Atom 1.60.0 Electron 9.4.4 Chrome 83.0.4103.122 Node v12.14.1
After a bit of digging, it appears that addind a
uniqueKey
option to the command parser solves the issue.const options = { stdin: text, cwd, ignoreExitCode: true, uniqueKey:`ShellCheck:${filePath}` };
in
https://github.com/AtomLinter/linter-shellcheck/blob/d29c89062af89705269ae98077438565572061cf/lib/main.js#L77
Got the idea from there: https://github.com/steelbrain/atom-linter#unique-spawning
Thank you @jagaudin! I have no idea why after so long they still haven't fixed this. Perhaps you could send a PR fix the fix?
Nevermind, that didn't fix it really. Will have to set the timeout
to "infinite" after all..
By the way, for those running Atom from Flatpak, the path to helpers.js
is:
~/.var/app/io.atom.Atom/data/packages/linter-shellcheck/node_modules/atom-linter/lib/helpers.js
Also, the line here is a var
not a const
.
And the line to change is i think: Line 105
var spawned = callback(filePath, parameters, Object.assign({ timeout: 10000 }, options));
So editing to:
var spawned = callback(filePath, parameters, Object.assign({ timeout: Infinity }, options));
And that fixes the issue.
@Megaf I spent quite some time trying to figure this out but the code is hard to understand and poorly commented. So I just ended up using Infinity for the timeout parameter as you did.