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

TMonitor thread remains active after tqdm closes #1564

Open
4 of 6 tasks
Linchin opened this issue Apr 10, 2024 · 1 comment
Open
4 of 6 tasks

TMonitor thread remains active after tqdm closes #1564

Linchin opened this issue Apr 10, 2024 · 1 comment

Comments

@Linchin
Copy link

Linchin commented Apr 10, 2024

  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)

Version numbers, system and environment

>>> import tqdm, sys
>>> print(tqdm.__version__, sys.version, sys.platform)
4.66.2 3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:22) [GCC 12.3.0] linux

Issue
(originally a customer issue in googleapis/python-bigquery-pandas#613)
After using tqdm.close(), a thread by TMonitor remains open. When I set tqdm.tqdm.monitor_interval = 0, TMonitor is disabled and thus does not start a new thread. Reproduction code:

import tqdm
import threading

def print_active_threads():
    for item in threading.enumerate():
        print(item)

# Uncomment this line results in no TMonitor thread
# tqdm.tqdm.monitor_interval = 0 

print("before tqdm")
print_active_threads()

numbers = list(range(3))
pbar = tqdm.tqdm(numbers)

for _ in pbar:
    pass

pbar.close()

print("after tqdm")
print_active_threads()

Output:

before tqdm
<_MainThread(MainThread, started 139831307290432)>
100%|████████████████████████████████████| 3/3 [00:00<00:00, 68015.74it/s]
after tqdm
<_MainThread(MainThread, started 139831307290432)>
<TMonitor(Thread-1, started daemon 139831290099392)>
@alonks1234
Copy link

I am seeing this too, would appreciate some assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants