flood icon indicating copy to clipboard operation
flood copied to clipboard

Uncaught exception: Error: Cannot create a string longer than 0x1fffffe8 characters

Open siloportem opened this issue 3 years ago • 21 comments

Type: Bug Report

Your Environment

  • Version used:
    • v4.6.1
    • 9eeff18
  • Environment name and version:
    • Node.js version v16.7.0
    • npm version 7.21.1
    • Web browser irrelevant
  • Operating system and version: Manjaro Linux aarch64
  • Torrent client and version: rtorrent 0.9.8

Summary

Starting flood by calling npm run start -- --host 0.0.0.0 --port 3000 fails with the following exception: Uncaught exception: Error: Cannot create a string longer than 0x1fffffe8 characters.

Full output is:

➜  npm run start -- --host 0.0.0.0 --port 3000

> [email protected] start
> node --use_strict dist/index.js "--host" "0.0.0.0" "--port" "3000"

Flood server 4.6.1 starting on http://0.0.0.0:3000

(node:297655) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use 'node --trace-deprecation ...' to show where the warning was created)
FATAL internal error. Please open an issue.
Uncaught exception: Error: Cannot create a string longer than 0x1fffffe8 characters

Expected Behavior

flood starts succesfully

Steps to Reproduce

  1. Download flood source tarball (tried it with v4.6.1 and 4.5.4)
  2. npm install
  3. npm run build
  4. npm run start -- --host 0.0.0.0 --port 3000

Context

I was running flood successfully before. After upgrading to v4.6.1 flood fails to start. Trying to build and use a previously working version again fails with the same exception.

siloportem avatar Sep 01 '21 21:09 siloportem

Hmm, 0x1fffffe8 is 512MB. May I ask how many torrents are there?

jesec avatar Sep 01 '21 22:09 jesec

and are you using the vanilla rTorrent or the JSON-RPC version?

jesec avatar Sep 01 '21 22:09 jesec

There are currently 20 torrents active in rTorrent.

I use vanilla rTorrent and have not updated rTorrent or changed the rTorrent configuration for a long time. Tomorrow I could try to build and run JSON-RPC rTorrent to see if I get the same error, if it helps?

siloportem avatar Sep 01 '21 22:09 siloportem

Encountering the same issue after an upgrade to latest. Using docker-compose of jesec/flood and jesesc/rtorrent with 2144 torrents. Reverting to flood 4.5.3 did not resolve the issue.

davmin avatar Sep 11 '21 22:09 davmin

Encountering the same issue after an upgrade to latest. Using docker-compose of jesec/flood and jesesc/rtorrent with 2144 torrents. Reverting to flood 4.5.3 did not resolve the issue.

Could you please run the debugging version (jesec/flood:master-dbg) ?

It should have more meaningful logs.

jesec avatar Sep 12 '21 01:09 jesec

Seeing the same issue. Using jesec/flood:master-dbg on Docker 20.10.8.

> [email protected] start:development:server
> NODE_ENV=development TS_NODE_PROJECT=server/tsconfig.json ts-node-dev --transpile-only -r tsconfig-paths/register server/bin/start.ts "--host=0.0.0.0" "--port" "3000" "--allowedpath" "/data"
[INFO] 05:51:04 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.4.3)
Flood server 0.0.0-master.3563344 starting on http://0.0.0.0:3000
(node:24) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (node:buffer:593:37)
    at Buffer.toString (node:buffer:811:14)
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:63:23)
[ERROR] 05:51:07 Error: Cannot create a string longer than 0x1fffffe8 characters

jboiselle avatar Sep 13 '21 05:09 jboiselle

I'm experiencing same issues right now. Same for master-dbg as well as master-distroless and other versions released on Docker.

I tried downgrading, up to v4.0. Most versions on the way showed me something like this:

image

What you can see here is that there's a minifed code being printed out for some reason. It might be possible that the same happens for newer versions, but the buffer with code is somehow so big that it can't fit there.

The screenshot shows the end and the beginning of that output.

I've tested on two separate machines: Arch and Ubuntu Server installs, both running Docker (via compose like in the wiki).

slagiewka avatar Sep 15 '21 16:09 slagiewka

Ok, seems that I have found the root cause: loading history.

I've previously stated that I had problems on two separate machines... but the new one had config rsynced from the old one.

Clean setup worked.

Digging deeper has shown me this:

~/dlconfig/.local/share/flood/db/b9Opj6gCUkwJkaD6/history$ ls -alh
total 896M
drwxr-xr-x 2 shimmy shimmy 4.0K Sep 15 16:40 .
drwxr-xr-x 4 shimmy shimmy 4.0K Sep 15 16:40 ..
-rw-r--r-- 1 shimmy shimmy    0 Sep 15 16:40 daySnapshot.db
-rw-r--r-- 1 shimmy shimmy 896M Aug  1 15:09 fiveMinSnapshot.db
-rw-r--r-- 1 shimmy shimmy    0 Sep 15 16:40 hourSnapshot.db
-rw-r--r-- 1 shimmy shimmy  35K Sep 15 16:40 monthSnapshot.db
-rw-r--r-- 1 shimmy shimmy    0 Sep 15 16:40 thirtyMinSnapshot.db
-rw-r--r-- 1 shimmy shimmy  59K Sep 15 16:40 weekSnapshot.db
-rw-r--r-- 1 shimmy shimmy 3.1K Sep 15 16:40 yearSnapshot.db

After I've deleted the 896 MB(!) snapshot, Flood started working as before.

slagiewka avatar Sep 15 '21 16:09 slagiewka

After I've deleted the 896 MB(!) snapshot, Flood started working as before.

Same for me. Deleted fiveMinSnapshot.db which had a size of more than 800MB. Now flood works again.

siloportem avatar Sep 16 '21 11:09 siloportem

For me it was in the path:

[whatever your flood path is]/db/_config/history

Jogai avatar Nov 30 '21 21:11 Jogai

Same for me. My journalctl said

flood[7829]: Flood server 4.7.0 starting on http://127.0.0.1:3000
flood[7829]: (node:7829) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
flood[7829]: (Use `node --trace-deprecation ...` to show where the warning was created)
flood[7829]: FATAL internal error. Please open an issue.
flood[7829]: Uncaught exception: Error: Cannot create a string longer than 0x1fffffe8 characters

I deleted fiveMinSnapshot.db and now Flood start !

total 879228
-rw-r--r-- 1 rtorrent rtorrent         0 déc.  15 13:07 daySnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 900167468 nov.   7 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent         0 déc.  15 13:07 hourSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent     53218 déc.  15 13:07 monthSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent         0 déc.  15 13:07 thirtyMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent     65437 déc.  15 13:07 weekSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent      5235 déc.  15 13:07 yearSnapshot.db

TTR6214 avatar Dec 15 '21 12:12 TTR6214

Thanks for everyone involved in the debugging, I'm facing the same issue too, even on version 4.7.0. The fix was to remove the fiveMinSnapshot.db in my case too.

Fire-Dragon-DoL avatar Dec 28 '21 01:12 Fire-Dragon-DoL

Thanks for the help everyone. With Flood v4.7.0 this bug still persists as of June 6th, 2022.

At least one can manually delete fiveMinSnapshot.db as a temporary fix. Mine was showing at 530 MB !

SiraVista avatar Jun 06 '22 18:06 SiraVista

Found this issue as well today. Deleting the file that was almost a gig resolved it.

1017M Jul  8 21:34 fiveMinSnapshot.db

bbashy avatar Jul 08 '22 20:07 bbashy

Had this aswell, deleting the file instantly fixes it.

JeremyMahieu avatar Nov 11 '22 09:11 JeremyMahieu

Hit this myself just now. For anyone finding this, the fiveMinSnapshot.db file can be in multiple places in the flood tree, and the first one you find might not be the issue.

itsthejoker avatar Jun 29 '23 03:06 itsthejoker

I'm facing the same problem, however I don't have any snapshot file, only a users.db file.

HexPandaa avatar Aug 11 '23 11:08 HexPandaa

I'm facing the same problem, however I don't have any snapshot file, only a users.db file.

Next to the users.db file will be a directory with a string of characters that look like an ID(mine was 16 characters long), navigate into that directory and look for another directory called 'history'. It will be in there.

clintjedwards avatar Aug 14 '23 07:08 clintjedwards

Clearly, there is something wrong with the fiveMinSnapshot.db file. It just grows forever, and not every 5 minutes, but all the time.

$ cd /home/rtorrent/.local/share/flood/db/<RANDOM-STRING>/history

$ systemctl stop [email protected]
$ rm -fv fiveMinSnapshot.db 
removed 'fiveMinSnapshot.db'
$ systemctl start [email protected]

$ while true; do ls -lh fiveMinSnapshot.db; sleep 5; done
-rw-r--r-- 1 rtorrent rtorrent 77 Aug 30 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 338 Aug 30 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 522 Aug 30 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 783 Aug 30 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 952 Aug 30 23:40 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 1.2K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 1.4K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 1.7K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 1.8K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 2.1K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 2.3K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 2.5K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 2.7K Aug 30 23:41 fiveMinSnapshot.db
-rw-r--r-- 1 rtorrent rtorrent 2.9K Aug 30 23:41 fiveMinSnapshot.db
...

elboulangero avatar Aug 31 '23 03:08 elboulangero