Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Diagnose and fix FastAPI hangs caused by blocking ThreadPoolExecutor shutdown in the news stream route; includes py-spy capture and non-blocking executor pattern.
.claude/skills/aiskillstore-backend-hang-debug/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 100% | 7 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -1% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 41% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -53% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 48% | 0% |
curl http://localhost:8000/ times out) due to synchronous executor shutdown in the SSE news stream.py-spy to capture live stacks and pinpoint blocking code.backend/app/api/routes/stream.py (news stream), backend/app/services/rss_ingestion.py (RSS workers), startup processes.py-spy for live stack dumps; curl with timeouts for smoke tests.curl -m 5 http://localhost:8000/ and curl -m 5 http://localhost:8000/health; note timeouts.ss -tlnp | grep 8000 to confirm listener; ls /proc/$(pgrep -f "uvicorn app.main")/fd | wc -l to rule out FD leak.uv pip install py-spy then sudo /home/bender/classwork/Thesis/backend/.venv/bin/py-spy dump --pid $(pgrep -f "uvicorn app.main") (and worker pid if multiprocess). Look for ThreadPoolExecutor.shutdown in api/routes/stream.py frames.with ThreadPoolExecutor(...): inside event_generator with a long-lived executor plus explicit non-blocking shutdown:finally, call executor.shutdown(wait=False, cancel_futures=True).shutdown(wait=True), blocking the event loop if RSS worker threads hang on network I/O.backend/app/api/routes/stream.py:executor = concurrent.futures.ThreadPoolExecutor(max_workers=5).loop.run_in_executor(executor, _process_source_with_debug, ...).cancel() pending futures.finally, executor.shutdown(wait=False, cancel_futures=True).rss_ingestion.py) since it runs in background threads, but ensure request timeouts remain reasonable (currently 60s per RSS requests.get).curl -m 5 http://localhost:8000/health should respond.py-spy dump to verify no ThreadPoolExecutor.shutdown(wait=True) frames in main thread.curl -m 5 http://localhost:8000/ returns a response (no hang).curl -m 5 http://localhost:8000/health succeeds./news/stream does not freeze subsequent requests.py-spy dump shows event loop not blocked on ThreadPoolExecutor.shutdown.py-spy on each worker pid when diagnosing hangs.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 27,198 | 18,523 | -32% | 1 | 1 | 0% | 3,983 | 3,502 | -12% | 0 | 0 | — |
case-02 | pass→pass | 17,697 | 16,487 | -7% | 1 | 1 | 0% | 3,190 | 3,163 | -1% | 0 | 0 | — |
case-03 | fail→pass | 25,614 | 13,033 | -49% | 1 | 1 | 0% | 3,550 | 3,498 | -1% | 0 | 0 | — |
case-04 | fail→pass | 32,514 | 3,885 | -88% | 1 | 1 | 0% | 1,146 | 1,620 | +41% | 0 | 0 | — |
case-05 | fail→pass | 14,875 | 3,846 | -74% | 1 | 1 | 0% | 2,828 | 1,329 | -53% | 0 | 0 | — |
case-06 | fail→pass | 8,864 | 9,812 | +11% | 1 | 1 | 0% | 1,031 | 1,529 | +48% | 0 | 0 | — |
case-07 | fail→pass | 22,772 | 18,604 | -18% | 1 | 1 | 0% | 2,887 | 1,507 | -48% | 0 | 0 | — |
case-08 | fail→pass | 19,487 | 15,141 | -22% | 1 | 1 | 0% | 2,676 | 2,965 | +11% | 0 | 0 | — |
case-09 | pass→pass | 20,580 | 32,827 | +60% | 1 | 1 | 0% | 2,941 | 2,920 | -1% | 0 | 0 | — |
case-10 | pass→pass | 16,596 | 21,615 | +30% | 1 | 1 | 0% | 1,548 | 1,298 | -16% | 0 | 0 | — |
case-11 | pass→pass | 29,526 | 8,286 | -72% | 1 | 1 | 0% | 1,074 | 1,314 | +22% | 0 | 0 | — |
case-12 | fail→fail | 34,969 | 23,537 | -33% | 1 | 1 | 0% | 2,513 | 3,918 | +56% | 0 | 0 | — |
case-13 | fail→pass | 16,209 | 3,920 | -76% | 1 | 1 | 0% | 1,169 | 1,566 | +34% | 0 | 0 | — |
case-14 | fail→pass | 27,375 | 20,827 | -24% | 1 | 1 | 0% | 2,167 | 1,172 | -46% | 0 | 0 | — |
case-15 | fail→pass | 33,378 | 13,059 | -61% | 1 | 1 | 0% | 2,411 | 1,562 | -35% | 0 | 0 | — |
case-16 | pass→pass | 23,480 | 17,682 | -25% | 1 | 1 | 0% | 3,068 | 3,054 | -0% | 0 | 0 | — |
case-17 | fail→fail | 32,834 | 15,817 | -52% | 1 | 1 | 0% | 2,152 | 2,220 | +3% | 0 | 0 | — |
case-18 | pass→pass | 20,128 | 13,286 | -34% | 1 | 1 | 0% | 2,473 | 3,140 | +27% | 0 | 0 | — |
case-19 | fail→pass | 30,463 | 26,125 | -14% | 1 | 1 | 0% | 1,629 | 1,682 | +3% | 0 | 0 | — |
case-20 | pass→pass | 25,746 | 32,005 | +24% | 1 | 1 | 0% | 2,928 | 3,618 | +24% | 0 | 0 | — |
case-21 | fail→pass | 24,004 | 76,134 | +217% | 1 | 1 | 0% | 3,182 | 4,224 | +33% | 0 | 0 | — |
case-22 | fail→fail | 68,135 | 33,806 | -50% | 1 | 1 | 0% | 3,177 | 3,461 | +9% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +55 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.