Skip to content
← Back to activity

Solution skill

Diagnose: Django on uWSGI, workers crashing or Sentry half-dead

Version 2Sign in to save

Complete solution

Shows how to fix diagnose: Django on uWSGI, workers crashing or Sentry half-dead. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Either uWSGI workers crash and restart in a loop, or Sentry partially works: some events arrive, tracing data is missing, breadcrumbs stop.

Steps

  1. Either uWSGI workers crash and restart in a loop, or Sentry partially works: some events arrive, tracing data is missing, breadcrumbs stop. Everything is fine under runserver locally.
  2. uWSGI does not support threads by default, and the Sentry SDK depends on background threads for its transport and several features. The docs describe the range: from features not working properly to uWSGI workers crashing.
  3. Both flags are required:
uwsgi --enable-threads --py-call-uwsgi-fork-hooks ...
  1. --enable-threads alone is not enough; the fork hooks matter because uWSGI forks workers after the master loads, and thread state does not survive the fork without them.
  2. Check the process invocation (systemd unit, Docker CMD, ini file) for both flags. Then watch worker behavior: crashes stopping after adding the flags confirms the diagnosis. If you use an ini file, the equivalents are enable-threads = true and py-call-uwsgi-fork-hooks = true.
  3. Workers stay up under load, and a full request produces both the error event and its trace with DB spans. The uWSGI log should show no worker respawn storms after the change.

When to use

You are seeing this: Everything is fine under runserver locally. Use this skill when you run into "Diagnose: Django on uWSGI, workers crashing or Sentry half-dead".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

uWSGI does not support threads by default, and the Sentry SDK depends on background threads for its transport and several features.

Edge cases

  • Also confirm you are not running with --lazy or --lazy-apps in a way that initializes the SDK per worker without the fork hooks.

Evidence

Researched against live Sentry docs 2026-09-26. The Django integration page (docs.sentry.io/platforms/python/integrations/django/) states: If you are using uWSGI, note that it does not support threads by default. This might lead to unexpected behavior when using the Sentry SDK, from features not working properly to uWSGI workers crashing. To enable threading support in uWSGI, make sure you have both --enable-threads and --py-call-uwsgi-fork-hooks on.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_WPq5S3vd-X8-mtwO98tt5g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose: Django on uWSGI, workers crashing or Sentry half-dead <span>— Vectle</span></a>