Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught RangeError: Invalid string length #7210

Closed
ghost opened this issue Jun 10, 2015 · 21 comments · Fixed by #14435
Closed

Uncaught RangeError: Invalid string length #7210

ghost opened this issue Jun 10, 2015 · 21 comments · Fixed by #14435

Comments

@ghost
Copy link

@ghost ghost commented Jun 10, 2015

To reproduce:

  1. dd if=/dev/zero of=largefile count=1 bs=1000M; if this does not reproduce play around with adjusting bs and count.
  2. Open atom and try to open largefile.

Atom Version: 0.208.0
System: Ubuntu 15.04
Thrown From: Atom Core

Stack Trace

Uncaught RangeError: Invalid string length

At /usr/share/atom/resources/app.asar/node_modules/pathwatcher/lib/file.js:301

RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (/usr/share/atom/resources/app.asar/node_modules/pathwatcher/lib/file.js:301:43)
    at emitNone (events.js:72:20)
    at ReadStream.emit (events.js:163:7)
    at _stream_readable.js:891:16
    at process._tickCallback (node.js:357:13)

Commands

  2x -3:24.1.0 release-notes:show (atom-text-editor.editor.is-focused)

Config

{
  "core": {},
  "editor": {
    "invisibles": {},
    "tabLength": 4
  }
}

Installed Packages

# User
No installed packages

# Dev
No dev packages
@Raynes

This comment has been minimized.

Copy link

@Raynes Raynes commented Jun 24, 2015

Just got this as well.

@izuzak

This comment has been minimized.

Copy link
Member

@izuzak izuzak commented Jun 26, 2015

There's another report of this and more details in #7417.

/cc @nathansobo

@kevinsawicki kevinsawicki mentioned this issue Jul 6, 2015
54 of 108 tasks complete
@arindell

This comment has been minimized.

Copy link

@arindell arindell commented Jul 10, 2015

[Enter steps to reproduce below:]

  1. Atom was already open
  2. try to open a 360 MB log file with Atom

Atom Version: 1.0.0
System: Windows 7
Thrown From: Atom Core

Stack Trace

Uncaught RangeError: Invalid string length

At D:\xxx\Atom\resources\app.asar\node_modules\pathwatcher\lib\file.js:301

RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (D:\xxx\Atom\resources\app.asar\node_modules\pathwatcher\lib\file.js:301:43)
    at emitNone (events.js:72:20)
    at ReadStream.emit (events.js:163:7)
    at _stream_readable.js:891:16
    at process._tickCallback (node.js:357:13)

Commands

Config

{
  "core": {},
  "editor": {
    "fontSize": 13
  }
}

Installed Packages

# User
No installed packages

# Dev
No dev packages
@ButchDean

This comment has been minimized.

Copy link

@ButchDean ButchDean commented Aug 2, 2015

Tried to open a 360MB text file and got this too.

@cutecreep

This comment has been minimized.

Copy link

@cutecreep cutecreep commented Aug 19, 2015

76 MB file broke it

@karolis-sh

This comment has been minimized.

Copy link

@karolis-sh karolis-sh commented Sep 22, 2015

336MB file, also broke

@ssbarnea

This comment has been minimized.

Copy link

@ssbarnea ssbarnea commented Sep 29, 2015

Anyone working on this? It does limit the use of ATOM, a lot.

@maxbrunsfeld maxbrunsfeld added the atom label Sep 29, 2015
@wismill

This comment has been minimized.

Copy link

@wismill wismill commented Oct 6, 2015

Wow, I did not expect such limitation. Also broke here with 277MB.

@magic890

This comment has been minimized.

Copy link

@magic890 magic890 commented Dec 1, 2015

Very annoying issue, I've to keep using Sublime Text to deal with these situations. Fix this please.

[Enter steps to reproduce below:]

  1. Open a mid-large size file (tried with 324MB)

Atom Version: 1.2.4
System: Mac OS X 10.11.1
Thrown From: Atom Core

Stack Trace

Uncaught RangeError: Invalid string length

At /Applications/Atom.app/Contents/Resources/app.asar/node_modules/pathwatcher/lib/file.js:317

RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/pathwatcher/lib/file.js:317:38)
    at emitNone (events.js:72:20)
    at ReadStream.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

Commands

     -5:56.5.0 application:add-project-folder (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -5:43.5.0 core:move-down (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)

Config

{
  "core": {
    "projectHome": "/Users/xxx/yyy/"
  },
  "editor": {
    "invisibles": {},
    "showIndentGuide": true,
    "softWrap": true,
    "tabLength": 4,
    "tabType": "soft",
    "showInvisibles": true,
    "fontSize": 12
  }
}

Installed Packages

# User
file-icons, v1.6.12
language-hocon, v1.1.0
language-latex, v0.6.1
language-scala, v1.1.4
minimap, v4.16.2
pigments, v0.19.1

# Dev
No dev packages
@magic890

This comment has been minimized.

Copy link

@magic890 magic890 commented Dec 1, 2015

After a bit of research (source) I think that I've found the cause:

RangeError: Invalid string length meant that the String.prototype.length property was not representable in 32Bit. The IncrementalStringBuilder's part_length property is using a simple int to represent the length of a String.

Quoting @mraleph here, v8 has a String length limitation of (1 << 28) - 16. I assume this limitation is due to sign and pointer allocations (or reserved types that is checked against inside the VM).

(1 << 28) - 16
268435440

This is the actual maximum size of all String lengths. As even the Buffer implementation in IOJS is using Strings to represent binary data, you can't exceed that limit with a single String. So, if you try to read or write a file synchronously that is larger than ~268.44MB, you know that you will get an error message.

An alternative solution would be either splitting up the database with a mask (easiest method) or implementing an asynchronous pointer-manager and Stream writer implementation that uses String chunks smaller than 268435440 bytes and has an own virtual memory stack with chunks.

@MitchellCash

This comment has been minimized.

Copy link

@MitchellCash MitchellCash commented Mar 11, 2016

Steps to reproduce below:

  1. Download Australian Company Dataset from http://data.gov.au/dataset/asic-companies/resource/a1df019f-cb11-43e8-8d5d-0f830115c8a6
  2. You will download a CSV which is 815.4 MB on disk
  3. Open CSV in Atom

Atom Version: 1.5.4
System: Mac OS X 10.11.3
Thrown From: Atom Core

Stack Trace

Uncaught RangeError: Invalid string length

At /Applications/Atom.app/Contents/Resources/app.asar/node_modules/pathwatcher/lib/file.js:317

RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/pathwatcher/lib/file.js:317:38)
    at emitNone (events.js:72:20)
    at ReadStream.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

Commands

Config

{
  "core": {},
  "editor": {
    "fontSize": 11,
    "invisibles": {}
  }
}

Installed Packages

# User
No installed packages

# Dev
No dev packages
@magic890

This comment has been minimized.

Copy link

@magic890 magic890 commented Mar 11, 2016

@kevinsawicki please have a look into this.

@ghost

This comment has been minimized.

Copy link
Author

@ghost ghost commented May 21, 2016

I want to confirm that this is still an issue:

Atom Version: 1.7.3
System: Ubuntu 16.04
Thrown From: Atom Core

Stack Trace

Uncaught RangeError: Invalid string length

At /usr/share/atom/resources/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:307

RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (/usr/share/atom/resources/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:307:38)
    at emitNone (events.js:72:20)
    at ReadStream.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:465:9)
    at process._tickCallback (node.js:379:17)
@MitchellCash

This comment has been minimized.

Copy link

@MitchellCash MitchellCash commented Jun 9, 2017

If I follow the steps in my previous comment (#7210 (comment)) I still get the same issue, so it doesn't seem like this issue is solved.

Atom now seems to be directing me to issue #11690, so I have added 'Steps to Reproduce' there as well.

@50Wliu

This comment has been minimized.

Copy link
Member

@50Wliu 50Wliu commented Jun 9, 2017

@MitchellCash The issue has been fixed, it just hasn't reached a stable version of Atom yet. We close issues as soon as the fix is merged into the master branch, not when it is released.

@MitchellCash

This comment has been minimized.

Copy link

@MitchellCash MitchellCash commented Jun 9, 2017

@50Wliu sorry! I do realise that now, I shouldn't be posting so late at night!

@iamtodor

This comment has been minimized.

Copy link

@iamtodor iamtodor commented Jul 24, 2017

The same issue has happened. The .csv fIle is 278M.

Atom: 1.18.0
macOS: 10.12.5

Uncaught RangeError: Invalid string length
/Applications/Atom.app/Contents/Resources/app/node_modules/pathwatcher/lib/file.js:314
Hide Stack Trace
RangeError: Invalid string length
    at Array.join (native)
    at ReadStream.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/pathwatcher/lib/file.js:314:44)
    at emitNone (events.js:91:20)
    at ReadStream.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Also, it tells me: This is likely a bug in Atom. This issue has already been reported. and gives me link to the issue #14229

@maxbrunsfeld

This comment has been minimized.

Copy link
Contributor

@maxbrunsfeld maxbrunsfeld commented Jul 24, 2017

@iamtodor You might want to try opening this file with the Beta version of Atom, Atom 1.19. This issue should be fixed already.

@iamtodor

This comment has been minimized.

Copy link

@iamtodor iamtodor commented Jul 24, 2017

@maxbrunsfeld thank you for the reply, for the suggestion. Could you please help me to update from stable 1.18.0 to 1.19.beta5?

@50Wliu

This comment has been minimized.

Copy link
Member

@50Wliu 50Wliu commented Jul 26, 2017

@iamtodor You can install the Atom Beta at https://atom.io/beta. You'll be able to freely switch between Atom and Atom Beta whenever you want (your existing Atom installation will not be overridden).

@lock

This comment has been minimized.

Copy link

@lock lock bot commented Mar 31, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

@lock lock bot locked and limited conversation to collaborators Mar 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.