atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
733 stars 269 forks source link

Uncaught Error: spawn E2BIG #338

Open eiriks opened 9 years ago

eiriks commented 9 years ago

[Enter steps to reproduce below:]

  1. create a very large (30k key/val pairs) dictionary of words (python)
  2. use dict to look up words in a sentence
  3. hit cmd-i to run script from atom

The script runs fine from the terminal.

Atom Version: 0.187.0 System: Mac OS X 10.10.2 Thrown From: script package, v2.18.0

Stack Trace

Uncaught Error: spawn E2BIG

At child_process.js:1160

Error: spawn E2BIG
    at exports._errnoException (util.js:753:11)
    at ChildProcess.spawn (child_process.js:1160:11)
    at Object.exports.spawn (child_process.js:993:9)
    at new BufferedProcess (/Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:51:37)
    at ScriptView.module.exports.ScriptView.run (/Users/eirikstavelin/.atom/packages/script/lib/script-view.coffee:334:30)
    at ScriptView.module.exports.ScriptView.start (/Users/eirikstavelin/.atom/packages/script/lib/script-view.coffee:171:21)
    at ScriptView.module.exports.ScriptView.defaultRun (/Users/eirikstavelin/.atom/packages/script/lib/script-view.coffee:136:21)
    at atom-workspace.<anonymous> (/Users/eirikstavelin/.atom/packages/script/lib/script-view.coffee:59:24)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:246:29)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61

Commands

     -3:04.5 core:move-up (atom-text-editor.editor.is-focused)
     -3:03.2 editor:newline (atom-text-editor.editor.is-focused)
     -3:01.8 core:paste (atom-text-editor.editor.is-focused)
     -3:01.3 core:save (atom-text-editor.editor.is-focused)
  2x -2:19.8 core:backspace (atom-text-editor.editor.is-focused)
     -1:06.7 editor:newline (atom-text-editor.editor.is-focused)
     -1:02.1 core:paste (atom-text-editor.editor.is-focused)
     -0:59.7 core:save (atom-text-editor.editor.is-focused)
  2x -0:29.9 core:select-up (atom-text-editor.editor.is-focused)
     -0:11.5 core:paste (atom-text-editor.editor.is-focused)
     -0:08.9 core:move-up (atom-text-editor.editor.is-focused)
 13x -0:08.6 core:move-right (atom-text-editor.editor.is-focused)
     -0:06.4 core:move-left (atom-text-editor.editor.is-focused)
     -0:03.6 core:save (atom-text-editor.editor.is-focused)
     -0:01.3 core:select-all (atom-text-editor.editor.is-focused)
     -0:00.5 script:run (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-light-ui",
      "one-dark-syntax"
    ]
  }
}

Installed Packages

# User
color-picker, v1.4.4
script, v2.18.0

# Dev
No dev packages
erran commented 9 years ago

@eiriks could you provide a gist with an example script to reproduce this? :sweat_smile:

rgbkrk commented 9 years ago

Here's a sample script to generate a decently sized dict written out to e2big.py:

import string

words = map(string.strip, open("/usr/share/dict/words", "r").read().split())

# Reduce the size enough for Atom to handle
words = words[:len(words)/2]

keys = words[:len(words)/2]
values = words[len(words)/2:]

# Map half the words to the other half of the words
d = dict(zip(keys, values))

# Write a script out
ff = open("e2big.py", "w")
ff.write('d = ' + repr(d) + "\n")
ff.write("print(d['cornic'])\n")
ff.close()

print("e2big.py created")

I'm not getting the E2BIG to come up, but I do notice some peculiarities:

cmd-i type run works just fine selection of this huge file and then cmd-i gives me a strange error about python not existing (smaller selections work just fine)

Fun fact: without cutting the words list in half, this was too big for Atom to handle

screenshot 2015-05-06 23 32 16

rgbkrk commented 9 years ago

It's too bad they closed atom/atom#307, I'd love to work on a canvas based text editor that blits renderable sections. DOM be slow.

rgbkrk commented 9 years ago

Amusingly, I took this smaller file that Atom can handle and it locked up Visual Studio Code:

screenshot 2015-05-07 00 43 52

annnnnnd it's still loading. Props to atom for being able to load this file. :) (Though really, these dom based editors need to take a step back, mmap files, and blit segments of the overall editing pane).