Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot run the following code in Docker #116638

Closed
houxinlin opened this issue Mar 12, 2024 · 3 comments
Closed

I cannot run the following code in Docker #116638

houxinlin opened this issue Mar 12, 2024 · 3 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@houxinlin
Copy link

houxinlin commented Mar 12, 2024

Bug report

Bug description:

This is my code

import threading
def print_text():

    print("Hello, world!")

    timer = threading.Timer(1, print_text)
    timer.start()

print_text()

I can run it on any platform, it works normally and outputs text every 1 second。
But I got this error in Docker

Hello, world!
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 1431, in run
    self.function(*self.args, **self.kwargs)
  File "/home/hxl/python-agent/test2.py", line 8, in print_text
    timer.start()
  File "/usr/local/lib/python3.12/threading.py", line 992, in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
root@d15684d1c27b:/home/hxl/python-agent# 

This is my platform information
os:

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ uname -a
Linux hxl 5.15.0-100-generic #110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

docker:

$ sudo docker -v
Docker version 25.0.4, build 1a576c5

Python version in Docker

$ python -V
Python 3.12.2

CPython versions tested on:

3.12

Operating systems tested on:

Linux

@houxinlin houxinlin added the type-bug An unexpected behavior, bug, or error label Mar 12, 2024
@sobolevn
Copy link
Member

Looks like a duplicate of #113964

@ronaldoussoren
Copy link
Contributor

Looks like a duplicate of #113964

I agree.

@sobolevn sobolevn closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
@houxinlin
Copy link
Author

Looks like a duplicate of #113964

I agree.

I have carefully examined this question, but I have not found the answer. This code only works abnormally in Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants