Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Process execution timed out #110

Open
villasenor opened this issue Dec 9, 2017 · 16 comments
Open

Process execution timed out #110

villasenor opened this issue Dec 9, 2017 · 16 comments

Comments

@villasenor
Copy link

villasenor commented Dec 9, 2017

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

@leagris
Copy link

leagris commented May 28, 2020

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

@leagris
Copy link

leagris commented Jun 14, 2020

Found how to fix:

  1. Go to Packages / Linter Shellcheck settings.
  2. Fill the Timeout field with any large enough value or Infinity.

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: steelbrain/exec#101

@seboudry
Copy link

Hi!
Having same timeout issue but didn't see any settings to configure it ...

Atom 1.48.0 on Ubuntu

@d-hr
Copy link

d-hr commented Jul 17, 2020

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;

@sakishrist
Copy link

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.

@leagris
Copy link

leagris commented Dec 19, 2020

bump!

@sakishrist
Copy link

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.

image

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?

image

I'm honestly tangled in a spaghetti of code here so if anyone else has an idea, please chime in :)

@mlavi
Copy link

mlavi commented Jan 8, 2021

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
├── language-shellscript@0.28.2
├── format-shell@2.2.1
├── linter@3.2.3
├── linter-flake8@2.4.0
├── linter-jsonlint@1.4.0
├── linter-shellcheck@1.6.0
├── linter-spell@0.15.0 (disabled)
├── linter-ui-default@2.4.0

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

@mlavi
Copy link

mlavi commented Feb 15, 2021

~/.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

@jagaudin
Copy link

jagaudin commented Dec 6, 2021

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.

@jagaudin
Copy link

jagaudin commented Dec 28, 2021

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

const options = { stdin: text, cwd, ignoreExitCode: true };

Got the idea from there: https://github.com/steelbrain/atom-linter#unique-spawning

@jagaudin
Copy link

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...

@akwala
Copy link

akwala commented May 27, 2022

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

@Megaf
Copy link

Megaf commented Sep 24, 2022

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

const options = { stdin: text, cwd, ignoreExitCode: true };

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?

@Megaf
Copy link

Megaf commented Sep 24, 2022

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.

@jagaudin
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants