Shutdown errors in dev

Open
#788 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
django, python
Domain
observability

Research direction

Start with scout_apm/core/init.py and scout_apm/core/agent/socket.py, then inspect scout_apm/core/threading.py around the calls shown in the traceback. Reproduce the shutdown during a server reload or django-admin command on Python 3.12; done means shutdown no longer emits the interpreter-shutdown stacktrace.

Written by the indexing model from the issue text.

Description

Python 3.12, scout_apm_python 3.1.0
Looks like there are instances where the Core Agent doesn't quite shut down gracefully. I've seen this happen during server reloads as well as django-admin commands (which is probably a different question altogether). This might not be a problem, exactly, but it spews stacktraces.

Exception ignored in atexit callback: <function shutdown at 0x104ed9bc0>
Traceback (most recent call last):
  File "...lib/python3.12/site-packages/scout_apm/core/__init__.py", line 92, in shutdown
    CoreAgentSocketThread.wait_until_drained(
  File "...lib/python3.12/site-packages/scout_apm/core/agent/socket.py", line 62, in wait_until_drained
    cls.ensure_started()
  File "...lib/python3.12/site-packages/scout_apm/core/threading.py", line 23, in ensure_started
    cls._instance.start()
  File "...lib/python3.12/threading.py", line 992, in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown

Dominant language
Python
Stars
77
Forks
19
Avg merge
1d 9h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scoutapp/scout_apm_python

All issues in scoutapp/scout_apm_python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.