pool_crash_demo
pool_crash_demo
Marten app repro for issues potentially arising from crystal-db's connection pool when the application runs multi-threaded.
Run
shards install
crystal run manage.cr -- migrate
crystal run seed.cr
crystal build --release src/server.cr -o bin/server
# control: single-threaded
./bin/server > server.log 2>&1 &
ab -k -c 60 -n 100000 http://127.0.0.1:8000/items/7
# multi-threaded
MARTEN_PARALLELISM=4 ./bin/server > server.log 2>&1 &
./script/load_test.sh 30 60
# error traces (and the crash backtrace, if it dies) are in server.log:
grep -A5 'Internal Server Error\|Invalid memory access' server.log
script/load_test.sh [concurrency] [seconds] wraps ApacheBench (ab, preinstalled on macOS) to drive /items and /items/<id> concurrently with keep-alive.
Repository
pool_crash_demo
Owner
Statistic
- 0
- 0
- 0
- 0
- 2
- 8 days ago
- August 10, 2026
License
Links
Synced at
Mon, 10 Aug 2026 14:14:21 GMT
Languages