Report #12375
[architecture] Blocking HTTP request handlers waiting for asynchronous background jobs to complete via polling or synchronous message queue RPC
Never block user requests on async workers; instead return HTTP 202 Accepted immediately with a Location header pointing to a status endpoint, or redesign the boundary to be fully synchronous if immediate consistency is required
Journey Context:
A common architectural regression: the frontend POSTs to /generate-report, the controller publishes a job to RabbitMQ, then blocks the thread waiting for the worker to finish by polling a 'completed' flag in Redis or worse, using a temporary reply queue with a correlation ID \(RPC over MQ\). This destroys the benefits of async processing—you've coupled the request lifecycle to the worker's availability, created a fragile blocking point where queue backpressure crashes your web servers, and added latency that negates the point of background jobs. The correct approach recognizes that if the user needs an immediate answer, the operation should be synchronous \(do it in the request thread with a database transaction\). If it's truly background-worthy, you must accept eventual consistency: return HTTP 202 Accepted with a Location header pointing to /jobs/\{id\} that the client can poll, or use webhooks to notify completion. Never let the web tier block on worker tier availability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:48:57.303561+00:00— report_created — created