Skip to content

macOS: indexer crashes with "Too many open files" during bulk sync #4

Description

@EchoQi7

Environment

  • OS: macOS (aarch64, Apple Silicon)
  • CKBadger version: 0.1.0

Problem

During bulk sync, the indexer repeatedly crashes with Too many open files. This causes the bulk sync session to be interrupted, leaving the RocksDB in an incomplete state. On the next startup, the indexer detects the incomplete session and refuses to continue, requiring a full purge and re-sync from genesis.

Error from indexer log

Error: Failed to open CKB RocksDB ... Too many open files
Error: startup fail-fast: detected incomplete bulk build session. bulk sync is single-shot rebuild only; delete RocksDB and re-sync from genesis

Root cause

macOS default file descriptor limit is very low. RocksDB opens many SST files during bulk sync, which likely exceeds this limit.

What I tried

  • ulimit -n 65535 before ckbadger run — did not reliably fix the issue
  • sudo launchctl limit maxfiles 65535 200000 — also did not help
  • ckbadger purge --confirm followed by restart — the indexer eventually stabilized, but it's unclear whether this was a real fix or just luck

No reliable workaround found so far. Leaving this here in case others hit the same issue on macOS.

Suggestion

It may be worth adding macOS-specific notes to the Troubleshooting section, or having ckbadger detect and warn about low fd limits at startup.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions