Skip to content

Device discovery increasing thread count #27

@chwiede

Description

@chwiede

Hi,

thanks for implementing this library, running great except one little thing.

I'm using the lib on a headless raspberry pi in a long-running process. To detect changes of my soundtouch-devices i'm callnig libsoundtouch.discover_devices frequently (e.g. all 30 minutes). After some while, i'm getting this error:

File "/usr/lib/python2.7/threading.py", line 736, in start 
    _start_new_thread(self.__bootstrap, ())
error: can't start new thread

Testscript

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import threading
import libsoundtouch

for i in range(10):
    print("starting discovery... ", end='')
    libsoundtouch.discover_devices(timeout=1)
    print("active threads are now %s" % threading.active_count())

Output

starting discovery... active threads are now 4
starting discovery... active threads are now 7
starting discovery... active threads are now 10
starting discovery... active threads are now 13
starting discovery... active threads are now 16
starting discovery... active threads are now 19
starting discovery... active threads are now 22
starting discovery... active threads are now 25
starting discovery... active threads are now 28
starting discovery... active threads are now 31

So it looks like every call leaves 3 open threads. I'd looked into the code but i didn't find anything suspicious...

Any ideas?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions