Skip to content

[BUG] Race condition deadlock in multithreading console output #106

@private-gerackl

Description

@private-gerackl

Description

When used in multithreading mode, a deadlock occurs.

Steps to Reproduce

  1. uv add logly
  2. check.py
import threading
from time import sleep

from logly import logger

logger.configure(console=True)
debug_logger = logger(internal_debug=True, debug_log_path="./logly_debug.log")

def worker():
    sleep(1)
    while True:
        debug_logger.info("x", thread_id=threading.current_thread().ident)

for _ in range(10):
    threading.Thread(target=worker).start()
  1. uv run python -m check

Expected Behavior

So that the output of lines does not hang

Actual Behavior

[INFO] x | thread_id=132910754014784 | module=__main__ | function=worker
[INFO] x | thread_id=132910754014784 | module=__main__ | function=worker
[INFO] x | thread_id=132910754014784 | module=__main__ | function=worker

It always gets a different number of lines, but it stops completely one way or another.

Logly Version

0.1.6

Python Version

3.14

Operating System

Ubuntu 22.04

Installation Method

uv

Additional Context

No response

Internal Debug Logs (Optional but Highly Recommended)

[2026-03-31 16:05:48.857] [LOGLY-INFO] [debug_init] Internal debug logging started
[2026-03-31 16:05:48.857] [LOGLY-INFO] [init] PyLogger initialized (auto_update_check=true, internal_debug=true)
[2026-03-31 16:05:48.857] [LOGLY-INFO] [configure] Starting configuration
[2026-03-31 16:05:48.857] [LOGLY-CONFIG] [configure] level = INFO
[2026-03-31 16:05:48.857] [LOGLY-CONFIG] [configure] color = true
[2026-03-31 16:05:48.857] [LOGLY-CONFIG] [configure] json = false
[2026-03-31 16:05:48.857] [LOGLY-CONFIG] [configure] console = true

Solution Interest

Maybe, I'd like to contribute but need guidance

Question Type

When will this be fixed?

Additional Questions

No response

Checklist

  • I have searched for similar issues and couldn't find any
  • I have tried the latest version of Logly
  • I have included all relevant information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions