nim-atom icon indicating copy to clipboard operation
nim-atom copied to clipboard

Uncaught TypeError: Cannot read property 'process' of null

Open tmm1 opened this issue 10 years ago • 15 comments
trafficstars

Atom Version: 1.0.19 System: Mac OS X 10.11 Thrown From: nim package, v0.3.0

Stack Trace

Uncaught TypeError: Cannot read property 'process' of null

At /Users/tmm1/.atom/packages/nim/lib/persistent-caas.coffee:33

TypeError: Cannot read property 'process' of null
  at /Users/tmm1/.atom/packages/nim/lib/persistent-caas.coffee:33:19
  at FSReqWrap.oncomplete (fs.js:82:15)

Commands

     -0:40.5.0 vim-mode:undo (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
  2x -0:40 vim-mode:move-up (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:39 vim-mode:put-before (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:38.3.0 vim-mode:move-down (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
 11x -0:38.2.0 vim-mode:move-right (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
  2x -0:37.6.0 vim-mode:move-up (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:36.7.0 vim-mode:move-to-previous-word (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:35.6.0 vim-mode:change (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:35.5.0 vim-mode:move-to-next-word (atom-text-editor.editor.vim-mode.is-focused.operator-pending-mode)
     -0:34.8.0 vim-mode:activate-normal-mode (atom-text-editor.editor.vim-mode.is-focused.insert-mode)
     -0:34.5.0 core:save (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
  2x -0:33.9.0 blur (atom-text-editor.editor.vim-mode.is-focused.normal-mode)
     -0:05.0 vim-mode:undo (atom-text-editor.editor.vim-mode.normal-mode.is-focused)
     -0:03.4.0 core:save (atom-text-editor.editor.vim-mode.normal-mode.is-focused)
  2x -0:03.0 vim-mode:undo (atom-text-editor.editor.vim-mode.normal-mode.is-focused)
     -0:01.8.0 core:save (atom-text-editor.editor.vim-mode.normal-mode.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "terminal",
      "git-plus",
      "atomatigit",
      "term2",
      "language-nim"
    ],
    "themes": [
      "one-dark-ui",
      "atom-dark-syntax"
    ]
  },
  "nim": {
    "nimExecutablePath": "/usr/local/bin/nim",
    "nimsuggestEnabled": true,
    "nimsuggestExecutablePath": "~/.nimble/bin/nimsuggest"
  }
}

Installed Packages

# User
autocomplete-clang, v0.8.7
autocomplete-emojis, v2.2.2
color-picker, v2.0.12
ex-mode, v0.7.0
git, v0.0.0
go-plus, v3.5.1
language-puppet, v0.14.0
language-rust, v0.4.5
linter, v1.6.0
linter-rust, v0.2.9
minimap, v4.13.4
minimap-git-diff, v4.1.8
minimap-hide, v0.3.0
nim, v0.3.0
racer, v0.17.2
remote-atom, v1.2.7
rust-api-docs-helper, v0.5.1
script, v2.29.0
vim-mode, v0.60.0

# Dev
No dev packages

tmm1 avatar Sep 28 '15 19:09 tmm1

Seeing these as well:

Stack Trace

Uncaught Error: This socket has been ended by the other party

At events.js:141

Error: This socket has been ended by the other party
  at Socket.writeAfterFIN [as write] (net.js:266:12)
  at /Users/tmm1/.atom/packages/nim/lib/persistent-caas.coffee:33:34
  at FSReqWrap.oncomplete (fs.js:82:15)

tmm1 avatar Sep 28 '15 19:09 tmm1

Thanks for the report. It looks like nimsuggest is crashing, which happens a lot, but it's not being handled properly... I'm not able to reproduce this, can you check the javascript console for errors and copy/paste them here?

russpowers avatar Sep 28 '15 23:09 russpowers

persistent-caas.coffee:72 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:72 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:72 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:72 Nimsuggest crashed...
executor.coffee:68 ERROR: Command failed multiple times.
Command:
SUGGESTIONS: /src/nim/test.nim,8,8
Output:
Traceback (most recent call last)
nimsuggest.nim(355)      nimsuggest
nimsuggest.nim(336)      handleCmdLine
Error: unhandled exception: Cannot find Nim standard library: Nim compiler not in PATH [IOError]

ghost avatar Sep 29 '15 08:09 ghost

Ok, there was an issue with timing on some of the error handling related to temp files. That should be fixed now, although I can't verify it since I couldn't replicate the error. I'll leave this open, please let me know if either of you see that same null error anymore.

russpowers avatar Sep 29 '15 19:09 russpowers

Uncaught Error: read ECONNRESET
persistent-caas.coffee:74 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:74 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:74 Nimsuggest crashed...
events.js:141 Uncaught Error: read ECONNRESET
persistent-caas.coffee:74 Nimsuggest crashed...
executor.coffee:68 ERROR: Command failed multiple times.
Command:
SUGGESTIONS: /home/user/src/nim/project/test.nim,2,2
Output:
Error: cannot open '/home/user/src/nim/lib/system.nim'
Traceback (most recent call last)
nimsuggest.nim(355)      nimsuggest
nimsuggest.nim(345)      handleCmdLine
nimsuggest.nim(281)      mainCommand
modules.nim(205)         compileProject
modules.nim(188)         compileSystemModule
modules.nim(158)         compileModule
modules.nim(66)          doCRC
securehash.nim(22)       secureHashFile
sysio.nim(192)           readFile
system.nim(2537)         sysFatal
Error: unhandled exception: cannot open: /home/user/src/nim/lib/system.nim [IOError]

Problem is it looks for stdlib in wrong dir.

~ % whereis nim
nim: /home/user/src/nim/Nim/bin/nim

And stdlib is in /home/user/src/nim/Nim/lib.

ghost avatar Sep 30 '15 07:09 ghost

This looks like an internal problem with nimsuggest... It's crashing because it can't find a file.

russpowers avatar Sep 30 '15 07:09 russpowers

I'm having a similar issue, I have nimsuggest installed in ~/.nimble/bin and its unable to find system.nim:

SUGGESTIONS: /Users/tmm1/code/nim/compiler/pragmas.nim,848,68
Output:
Error: cannot open '/Users/tmm1/.nimble/pkgs/lib/system.nim'
Error: unhandled exception: cannot open: /Users/tmm1/.nimble/pkgs/lib/system.nim [IOError]

708 console messages are not shown.

tmm1 avatar Sep 30 '15 21:09 tmm1

In another project it's trying to access /usr/local/lib/system.nim when using /usr/local/bin/nim

ERROR: Command failed multiple times.
Command:
DEFINITION: /Users/tmm1/code/c2nim/postprocessor.nim,19,18
Output:
Error: cannot open '/usr/local/lib/nim/system.nim'
Error: unhandled exception: cannot open: /usr/local/lib/nim/system.nim [IOError]

tmm1 avatar Sep 30 '15 21:09 tmm1

I've been reading through the issues over at nimsuggest, and it looks like there are sometimes problems locating the nim library folder. The solution is either to move the nimsuggest executable into the nim bin folder or to explicitly set the lib path via the --lib nim compiler option. I've added a config key Nim Lib Path where you can set that library path. Try it out and let me know how it goes.

russpowers avatar Oct 01 '15 01:10 russpowers

This helps, thanks!

ghost avatar Oct 01 '15 07:10 ghost

I'm still hitting this issue occasionaly even though I have set lib path :( Edit: tightly related to #7

yglukhov avatar Jan 12 '16 11:01 yglukhov

Nimsuggest crashes constantly, especially if a macro is involved (if the macro evaluation crashes, nimsuggest crashes)... I've tried to write code that handles those crashes gracefully, but there must still be a problem there somewhere. I'll take a look.

russpowers avatar Jan 13 '16 06:01 russpowers

@russpowers, fyi, i'm still experiencing this problem occasionally: stack:

TypeError: Cannot read property 'process' of null
    at /Users/yglukhov/.atom/packages/nim/lib/persistent-caas.coffee:35:19
    at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/babel-core/node_modules/regenerator/node_modules/commoner/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:82:15)

yglukhov avatar Apr 07 '16 19:04 yglukhov

Thanks for the report @yglukhov. Sorry I haven't been able to fix this yet, been very busy on other projects. I will try to set aside some time to see if I can figure out what is causing this...

russpowers avatar Apr 13 '16 06:04 russpowers

I was able to look in dev tools and see that this was because nimsuggest itself was not finding the Nim compiler when the editor was started (though I had the full path in my package settings). I was able to work around by starting atom from a terminal with the $PATH set correctly.

I'll see if I can make a fix for this (by mutating the $PATH when starting nimsuggest).

singularperturbation avatar May 24 '16 03:05 singularperturbation