python3 deamon thread not auto-ending on script end

Bug #2054468 reported by Raymond Gabriel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3-defaults (Ubuntu)
New
Undecided
Unassigned

Bug Description

Python programs using threading with deamon = True not longer kill the thread once the python script is finished.

Here is a simple script to prove the point:

---
import threading as th
def thread_method():
    input()
thread_test = th.Thread(target=thread_method, args=(), name='daemon_exit_test', daemon=True)
thread_test.start()
print(thread_test.isDaemon())
print('print this then exit')
---

This creates a deamon thread, and holds it waiting for an input(), i.e. enter key.

In the past, because the flag deamon=True, as soon as it reaches the end of the script it will kill the thread. Now it does not behave like that, and holds the thread open, which can be ended manually by pushing the enter key to accept the input().

I tried in a python 3.9 and a python 3.12 environment, same issue.

Kernel Linux 6.5.0-17-generic x86_64

ProblemType: Bug
DistroRelease: Ubuntu 23.10
Package: python3 3.11.4-5
ProcVersionSignature: Ubuntu 6.5.0-17.17-generic 6.5.8
Uname: Linux 6.5.0-17-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.27.0-0ubuntu5
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: MATE
Date: Wed Feb 21 09:15:49 2024
InstallationDate: Installed on 2023-07-02 (234 days ago)
InstallationMedia: Ubuntu-MATE 23.04 "Lunar Lobster" - Release amd64 (20230415)
SourcePackage: python3-defaults
UpgradeStatus: Upgraded to mantic on 2024-02-17 (4 days ago)

Revision history for this message
Raymond Gabriel (rayzinnz) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.