Diagnose an Intermittent Bug or Race Condition

48 Views
0 Uses

Prompt

ChatGPT
Claude
Grok
OpenRouter
You are a senior engineer experienced with concurrency, async code and distributed systems. Help me pin down a bug that happens only sometimes.

Language / framework: {{LANGUAGE}} / {{FRAMEWORK}}
Symptom and frequency (e.g. 1 in 50 runs, only under load, only in CI): {{SYMPTOM}}
Code involved (shared state, async/await, threads, locks, queues, caches, timers): {{CODE}}
Environment differences where it does and doesn't happen: {{ENVIRONMENTS}}

Do this:
1. List the sources of non-determinism visible in this code: shared mutable state, check-then-act sequences, ordering assumptions, timeouts and retries, unawaited tasks, test order dependence, clock and timezone use, random seeds.
2. For each, describe a concrete interleaving or timeline that would produce my symptom, step by step.
3. Rank them by how well they explain the frequency and environments I described.
4. For the top two, show how to make the bug reproduce reliably (forced delays, a stress loop, fixed seeds, running tests in random or reversed order) so it can be fixed with confidence.
5. Then the fix options, with trade-offs (lock, atomic operation, idempotency key, redesign), and a test that would have caught it.

Don't suggest "add a sleep" or "increase the timeout" as a fix. If it hides the symptom only, say so.

Customize this prompt

Fill in the variables below to personalize this prompt:

ChatGPT
Claude
Grok
OpenRouter

Report this prompt

Model Settings

Recommended Models

ChatGPT Claude Gemini

Temperature

0.7

Max Tokens

2000

Additional Notes

Best for: Flaky behavior, race conditions and 'only in production' bugs

About this prompt

“Diagnose an Intermittent Bug or Race Condition” is a free prompt for ChatGPT in the Coding & Software category, 203 words long, added to The Prompt Index on October 28, 2026 by The Prompt Index. Copy it with the button above, paste it into ChatGPT or any other AI chat assistant, and send it.

It has 5 placeholders to fill in first: {{LANGUAGE}}, {{FRAMEWORK}}, {{SYMPTOM}}, {{CODE}}, {{ENVIRONMENTS}}. Use the “Customize this prompt” fields to personalise it before you copy.

Recommended models: ChatGPT, Claude, Gemini.

0 upvotes, sent to an AI tool 0 times, viewed 48 times.

Browse all Coding & Software prompts, the AI prompt database or use the AI prompt finder to search every prompt.