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

failed process file : failed send RangeError: Invalid string length #655

Closed
icoco opened this issue May 16, 2024 · 4 comments
Closed

failed process file : failed send RangeError: Invalid string length #655

icoco opened this issue May 16, 2024 · 4 comments

Comments

@icoco
Copy link

icoco commented May 16, 2024

failed send RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at Connection.send (code-server/node_modules/sharedb/lib/client/connection.js:493:27)

looks the file content too larger ?

@alecgibson
Copy link
Collaborator

Please provide a minimal repro case

@icoco
Copy link
Author

icoco commented May 16, 2024

I trace the log, it cause the field 'files' , if the 'files' value is large, then report the error bellows:

...  RangeError: Invalid string length
   at JSON.stringify (<anonymous>)
   at Connection.send....

the log message :

sharedb/lib/client/connection.js->SEND {
  a: 'op',
  c: 'documents',
  d: 'af03d59c381bcfc4a1816d342604fabe967c6d5a53e61459dff8c03b7be996c6',
  v: null,
  src: undefined,
  seq: 2,
  x: {},
  create: { type: 'p', data: { files: [Object] } }
}

data.files is very large object that contains many key=>value data

@alecgibson
Copy link
Collaborator

This is a general issue with you running out of memory. There will always be some limit there, and it looks like you've found it.

I'd first ask yourself from an architectural point of view just why this object has to be so large: transmitting this volume of data (presumably hundreds to thousands of MB?) down the wire is going to be exceptionally slow for your clients; and for any other clients who have to download this document.

If — for some reason — this is absolutely necessary, you should chunk your object up and submit smaller update ops. This loses the atomicity of a single create, but is the only practical solution for an arbitrarily large object.

@icoco
Copy link
Author

icoco commented May 17, 2024

I see, so can not put a directory that contains large files in to Sharedb document

@icoco icoco closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants