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

Not possible to save huge file ("Invalid string length") #32503

Closed
mehrdd opened this issue Aug 14, 2017 · 5 comments · Fixed by #41972
Closed

Not possible to save huge file ("Invalid string length") #32503

mehrdd opened this issue Aug 14, 2017 · 5 comments · Fixed by #41972
Assignees
Labels
file-io File I/O on-testplan verified Verification succeeded
Milestone

Comments

@mehrdd
Copy link

mehrdd commented Aug 14, 2017

Hello,

I have a mysqldump file which is 620mb.
it opens fine and it's way faster than sublime text (except highlighting SQL which is not important for such a big file)

but when i try to save the file it says : "Invalid string length"

VSCode : Version 1.15.0 (1.15.0)

@bpasero
Copy link
Member

bpasero commented Aug 19, 2017

This is an out of memory exception. Here is the stack trace:

Invalid string length: RangeError: Invalid string length
    at Array.join (native)
    at Model.TextModel.getValueInRange (file:///Users/bpasero/Development/Microsoft/monaco/out/vs/editor/common/model/textModel.js:325:32)
    at Model.TextModel.getValue (file:///Users/bpasero/Development/Microsoft/monaco/out/vs/editor/common/model/textModel.js:293:39)
    at TextFileEditorModel.BaseTextEditorModel.getValue (file:///Users/bpasero/Development/Microsoft/monaco/out/vs/workbench/common/editor/textEditorModel.js:135:30)

Looks like we should change our IFileService.updateContent method to work with a stream instead of requiring the entire value to be there upfront. We call this method 2 times, once for creating a backup of the file and once for saving the contents back.

@bpasero bpasero changed the title "Invalid string length" on saving huge file Not possible to save huge file ("Invalid string length") Aug 19, 2017
@deldrid1
Copy link

I have a similar issue - but mine is for reading a file.

messageService.ts:125Unable to open '2017-06-13T10-00-54Z_emcb_data.json': Invalid string length.: Error: Unable to open '2017-06-13T10-00-54Z_emcb_data.json': Invalid string length.
    at t.doHandleSetInputError (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:29:663401)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:29:663007
    at Object.v [as _notify] (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:52942)
    at Object.enter (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:56434)
    at n.Class.derive._creator._run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:57755)
    at n.Class.derive._creator._chainedError (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:57114)
    at n (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:54937)
    at n.Class.define.cancel.then (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:58564)
    at Object.enter (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:55006)
    at n.Class.derive._creator._run (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28:57755)
e.doShow @ messageService.ts:125

The file is a 13.12GB JSON Firebase backup file. I may be pushing the limit on VSCode's new "large file support", but figured I'd try :). The Macbook Pro I am using has 16GB RAM.

@bpasero bpasero modified the milestones: On Deck, Backlog Sep 1, 2017
@bpasero
Copy link
Member

bpasero commented Sep 11, 2017

It looks like V8 62 lifts the max string length to 2^30 (via https://v8project.blogspot.ch/2017/09/v8-release-62.html):

The maximum string length on 64-bit platforms increased from 2**28 - 16 to 2**30 - 25 characters.

(from 256 MB => 1 GB)

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Sep 22, 2017
@cx9527
Copy link

cx9527 commented Nov 1, 2017

Same problem on saving huge files.
Any updates to this issue?

@n3nikita
Copy link

I have the same problem, when I'm trying to save huge file. And when I click on Close button after this error I get another:
Cannot read property 'message' of undefined

@bpasero bpasero removed the bug Issue identified by VS Code Team member as probable bug label Feb 2, 2018
@chrmarti chrmarti added the verified Verification succeeded label Feb 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
file-io File I/O on-testplan verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants