Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Uncaught RangeError: Invalid string length #7210

Closed

Description

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

Activity

  1. Raynes commented on Jun 24, 2015

    @Raynes

    Just got this as well.

  2. izuzak commented on Jun 26, 2015

    @izuzak
    Contributor

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

    /cc @nathansobo

  3. arindell commented on Jul 10, 2015

    @arindell

    [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
  4. ButchDean commented on Aug 2, 2015

    @ButchDean

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

  5. cutecreep commented on Aug 19, 2015

    @cutecreep

    76 MB file broke it

  6. karolis-sh commented on Sep 22, 2015

    @karolis-sh

    336MB file, also broke

  7. ssbarnea commented on Sep 29, 2015

    @ssbarnea

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

  8. wismill commented on Oct 6, 2015

    @wismill

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

  9. magic890 commented on Dec 1, 2015

    @magic890

    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
  10. magic890 commented on Dec 1, 2015

    @magic890

    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.

  11. MitchellCash commented on Mar 11, 2016

    @MitchellCash

    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
  12. magic890 commented on Mar 11, 2016

    @magic890

    @kevinsawicki please have a look into this.

  13. MitchellCash commented on Jun 9, 2017

    @MitchellCash

    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.

  14. winstliu commented on Jun 9, 2017

    @winstliu
    Contributor

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

  15. MitchellCash commented on Jun 9, 2017

    @MitchellCash

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

  16. iamtodor commented on Jul 24, 2017

    @iamtodor

    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

  17. maxbrunsfeld commented on Jul 24, 2017

    @maxbrunsfeld
    Contributor

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

  18. iamtodor commented on Jul 24, 2017

    @iamtodor

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

  19. winstliu commented on Jul 26, 2017

    @winstliu
    Contributor

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

  20. lock commented on Mar 31, 2018

    @lock

    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!

  21. locked and limited conversation to collaborators on Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions