Skip to content

Fix django-debug-toolbar by reducing worker count#304

Closed
agjohnson wants to merge 1 commit into
mainfrom
agj/web-reduce-workers
Closed

Fix django-debug-toolbar by reducing worker count#304
agjohnson wants to merge 1 commit into
mainfrom
agj/web-reduce-workers

Conversation

@agjohnson
Copy link
Copy Markdown
Contributor

Debug toolbar has been pretty useless for a long time now, all pages in
the toolbar mostly show failures and only work a small portion of the
time. Reducing the worker count resolves this behavior and allows all
pages to function.

There might be a longer term fix here, the problem is likely the workers
not sharing some state that debug toolbar is expecting.

Debug toolbar has been pretty useless for a long time now, all pages in
the toolbar mostly show failures and only work a small portion of the
time. Reducing the worker count resolves this behavior and allows all
pages to function.

There might be a longer term fix here, the problem is likely the workers
not sharing some state that debug toolbar is expecting.
@agjohnson agjohnson requested a review from a team as a code owner May 22, 2026 01:48
@agjohnson agjohnson requested a review from humitos May 22, 2026 01:48
Copy link
Copy Markdown
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was set to multiple workers to have something more similar to production to catch errors more early. We could have a debug mode that enables DDT and sets the number of workers to 1 too, but I'm fine with this too.

@agjohnson
Copy link
Copy Markdown
Contributor Author

Yeah, though if we special case it, we likely won't use it. There might be a proper fix at the debug toolbar eventually too. But I'm fine getting back to that later and fixing the toolbar for now.

I think the toolbar should be quite important for development on the templates. It seemed like a struggle to debug templates without the toolbar, I'd like to make sure we're all using a workflow that actually works. The toolbar is the best way to inspect what templates are used and the context data to them, it's just unfortunate that it doesn't work with multiple workers currently.

Copy link
Copy Markdown
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after adding a comment in that file so we know why we are using only one worker.

fi

CMD="uv run gunicorn readthedocs.wsgi:application -w 3 -b 0.0.0.0:8000 --max-requests=10000 --timeout=0"
CMD="uv run gunicorn readthedocs.wsgi:application -w 1 -b 0.0.0.0:8000 --max-requests=10000 --timeout=0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add a comment here explaining why we are using only 1 worker.

@agjohnson
Copy link
Copy Markdown
Contributor Author

agjohnson commented Jun 2, 2026

Took another stab at resolving this, using cache storage seems promising. Trying out a PR at:

Seems to fix the issue for me.

@agjohnson agjohnson closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants