Skip to content

Dies after some "heavy" use #36

@lucacri

Description

@lucacri

Hi,
this has happened twice in the last 24 hours, but after running for a bit, I noticed that the API gives errors, and the terminal shows:

many of these:

Unhandled error: RangeError: Out of memory
    at stringify (unknown)
    at jsonResponse (/Users/lucacri/Sites/dev-tools/ccflare/packages/http-common/src/responses.ts:11:27)
    at <anonymous> (/Users/lucacri/Sites/dev-tools/ccflare/packages/http-api/src/router.ts:161:18)
    at <anonymous> (/Users/lucacri/Sites/dev-tools/ccflare/packages/http-api/src/router.ts:159:17)
    at handleRequest (/Users/lucacri/Sites/dev-tools/ccflare/packages/http-api/src/router.ts:179:41)
    at handleRequest (/Users/lucacri/Sites/dev-tools/ccflare/packages/http-api/src/router.ts:171:22)
    at fetch (/Users/lucacri/Sites/dev-tools/ccflare/apps/server/src/server.ts:225:40)
    at fetch (/Users/lucacri/Sites/dev-tools/ccflare/apps/server/src/server.ts:221:15)

Finally "crashes" but the console stays attached to the command (I assume it's the concurrent stuff in the npm).

============================================================
Bun v1.2.21 (7c45ed97) macOS Silicon
macOS v15.6.1
CPU: fp aes crc32 atomics
Args: "bun" "run" "apps/tui/src/main.ts" "--port" "8888"
Features: Bun.stderr(4) Bun.stdin(4) Bun.stdout(4) abort_signal(34) fetch(6530) http_server jsc transpiler_cache(2) tsconfig(42) tsconfig_paths(22) workers_spawned
Builtins: "bun:main" "bun:sqlite" "node:assert" "node:buffer" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:module" "node:os" "node:path" "node:process" "node:stream" "node:tty" "node:url" "node:util"
Elapsed: 54116691ms | User: 1404193ms | Sys: 1169643ms
RSS: 50.79GB | Peak: 0.08TB | Commit: 0.02ZB | Faults: 70 | Machine: 0.27TB

panic(main thread): Segmentation fault at address 0x10
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.2.21/Mr17c45ed94FuhkU_m0hqpBm0hqpB___mr/s8C2n72gCm2phpC+j68uCA2AgB

I noticed that when this happens, the sqlite db is always 19GB+

 ~/.config/ccflare  ls -lh
total 123203248
-rw-------@ 1 lucacri  staff    20G Aug 29 14:21 ccflare.db
-rw-------@ 1 lucacri  staff    40M Aug 29 14:14 ccflare.db-shm
-rw-------@ 1 lucacri  staff    19G Aug 29 14:30 ccflare.db-wal
-rw-r--r--@ 1 lucacri  staff   251B Aug 28 23:10 ccflare.json

and the db is corrupted:

sqlite3 ccflare.db ".dump"
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;

but after a while of trying do to a .backup, .dump etc, it worked again in showing the data in sqlite3.

sqlite3 ccflare.db
SQLite version 3.44.3 2024-03-24 21:15:01
Enter ".help" for usage hints.
sqlite> .backup foo
sqlite> .tables
accounts           oauth_sessions     requests
agent_preferences  request_payloads
sqlite> select count(*) from requests;
6523
sqlite> select count(*) from request_payloads;
6523

Unfortunately still does not boot :

bun run ccflare --port 8888
$ bun run build && bun run tui --port "8888"
$ bun run build:dashboard && bun run build:tui
$ bun run --cwd packages/dashboard-web build
$ bun run build.ts

🚀 Building dashboard...

🗑️ Cleaning previous build at /Users/lucacri/Sites/dev-tools/ccflare/packages/dashboard-web/dist
📄 Building dashboard from src/index.html

✅ Dashboard build completed in 484.73ms

📦 Output files:
   - dist/chunk-tw4cy010.js
   - dist/index.html
   - dist/chunk-m08cyhvd.css
   - dist/chunk-tw4cy010.js.map
   - dist/favicon-7fef0tsq.svg
$ bun run --cwd apps/tui build
$ bun build src/main.ts --compile --outfile dist/ccflare --target=bun
  [47ms]  bundle  674 modules
  [80ms] compile  dist/ccflare
$ bun run apps/tui/src/main.ts --port "8888"
Error: Failed to start server. Is port 8888 in use?
error: script "tui" exited with code 1
error: script "ccflare" exited with code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions