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

Backup failed with "Invalid string length" or out of memory #2042

Open
irudi opened this issue Nov 9, 2022 · 1 comment
Open

Backup failed with "Invalid string length" or out of memory #2042

irudi opened this issue Nov 9, 2022 · 1 comment

Comments

@irudi
Copy link

irudi commented Nov 9, 2022

I have a lot of objects and states (but that's another problem ...) - my states.jsonl is sized about 700MB.

If I try to backup, I get:

# iob backup
host.iobroker 68291 states saved
host.iobroker 31599 objects saved
host.iobroker Backup not created: Invalid string length
Backup created: undefined

A similar problem is reported in https://forum.iobroker.net/post/718012

I think the problem is the JSON.stringify function in setupBackup.ts (line 432). This function has problems with large input (as noted in #1717 as well).

There are some ideas to overcome this problem in https://stackoverflow.com/questions/29175877/json-stringify-throws-rangeerror-invalid-string-length-for-huge-objects

@Apollon77
Copy link
Collaborator

Maybe the idea to really do like stackoverflow had as idea (aka "store each key and build the highest stringify level yourself as string actions) - but then we could also prevent having a bit string in memory when doing backup and iteratively write that to the file ... could also reduce mem footprint of backup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants