I am using a thread for running all time in my project, and it dies silently without any log.
Here is the code I'm using in and upload_manager module
logger = logging.getLogger('upload_manager')
class UploadManager:
_thread = None
@classmethod
def _run(cls):
while cls._is_running:
try:
cls._process_queue()
time.sleep(5)
except Exception as ex:
logger.exception(ex)
cls._thread = None
logger.warn("Upload Manager Thread is finished")
@classmethod
def start(cls):
if cls._thread is not None:
# Thread already exists.
logger.warn("Uploading Manager Thread is already running.")
return
cls._thread = threading.Thread(name="uploader",
target=cls._run,
daemon=True)
cls._is_running = True
cls._thread.start()
logger.info("Upload Manager Thread is started");
I start this thread from some other module like this:
UploadManager.start()
The Code ran for about two, three days and after that stopped silently. Can anybody help me with this issue?