[Django] #36333: runserver: could not acquire lock for _io.BufferedWriter at interpreter shutdown

6 views
Skip to first unread message

Django

unread,
Apr 18, 2025, 8:15:26 AMApr 18
to django-...@googlegroups.com
#36333: runserver: could not acquire lock for _io.BufferedWriter at interpreter
shutdown
-------------------------------------+-------------------------------------
Reporter: Klaas van Schelven | Type:
| Uncategorized
Status: new | Component:
| Uncategorized
Version: 4.2 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I just ran into the following while running a `manage.py runserver`



{{{
Fatal Python error: _enter_buffered_busy: could not acquire lock for
<_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due
to daemon threads
Python runtime state: finalizing (tstate=0x000057b67d5dc5c0)
Current thread 0x0000722a9aa4d000 (most recent call first):
<no Python frame>
Extension modules: greenlet._greenlet,
zope.interface._zope_interface_coptimizations, gevent.libev.corecext,
gevent._gevent_c_greenlet_primitives, gevent._gevent_c_hub_local,
gevent._gevent_c_waiter, gevent._gevent_c_hub_primitives,
gevent._gevent_c_ident, gevent._gevent_cgreenlet,
gevent._gevent_c_abstract_linkable, gevent._gevent_cevent,
gevent._gevent_c_semaphore, gevent._gevent_cqueue, gevent._gevent_c_imap,
_brotli, markupsafe._speedups, psycopg2._psycopg, charset_normalizer.md
(total: 18)
}}}

Seems hard to debug, but since I'm not doing anything with threads myself,
I'm tempted to say this is caused by Django's multi-threaded server.

Why is the Python interpreter being shut down in the first place? It
doesn't say... this was during normal operation (perhaps I touched a file
and the server restarted? Can't tell).

--
I realize this may not be the best place to open this completely
unreproducable ticket, but it's not the worst either... at least it will
allow others to find it.

Similar thoughts about this occurring on Django 4.2 and that currently
being security-only. I'm just reporting what I found... if it was never
fixed, it's probably still around on 5.2
--
Ticket URL: <https://code.djangoproject.com/ticket/36333>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 21, 2025, 9:35:38 AMApr 21
to django-...@googlegroups.com
#36333: runserver: could not acquire lock for _io.BufferedWriter at interpreter
shutdown
-------------------------------------+-------------------------------------
Reporter: Klaas van Schelven | Owner: (none)
Type: Bug | Status: closed
Component: Core (Management | Version: 4.2
commands) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* component: Uncategorized => Core (Management commands)
* resolution: => needsinfo
* status: new => closed
* type: Uncategorized => Bug

Comment:

Hello Klaas van Schelven, thank you for your report. As you say, without a
failing test or a way to reproduce, it's not possible to accept this
ticket since it's not actionable. This report would also benefit from the
specific versions that you are using for Django, Python and the OS.

I'll close as `needsinfo` but please reopen if you can provide detailed
steps to reproduce.
--
Ticket URL: <https://code.djangoproject.com/ticket/36333#comment:1>

Django

unread,
Apr 22, 2025, 3:44:10 AMApr 22
to django-...@googlegroups.com
#36333: runserver: could not acquire lock for _io.BufferedWriter at interpreter
shutdown
-------------------------------------+-------------------------------------
Reporter: Klaas van Schelven | Owner: (none)
Type: Bug | Status: closed
Component: Core (Management | Version: 4.2
commands) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Klaas van Schelven):

I fully get that, and I'm not going to try to reproduce this myself. Let's
just see if others run into this and let them assemble here.

I was running Python 3.10 when this happened.
Django 4.2.
--
Ticket URL: <https://code.djangoproject.com/ticket/36333#comment:2>
Reply all
Reply to author
Forward
0 new messages