Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#36333 closed Bug (needsinfo)

runserver: could not acquire lock for _io.BufferedWriter at interpreter shutdown

Reported by: Klaas van Schelven Owned by:
Component: Core (Management commands) Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (2)

comment:1 by Natalia Bidart, 5 months ago

Component: UncategorizedCore (Management commands)
Resolution: needsinfo
Status: newclosed
Type: UncategorizedBug

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.

comment:2 by Klaas van Schelven, 5 months ago

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.

Note: See TracTickets for help on using tickets.
Back to Top