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

Logging: test multithreaded logging #57448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Feb 17, 2025

Investigating #57376

With and without the redirect there's no crash locally.
Ideally it'd be good to test logging to the console but I don't think we can do that without noisy logs on the console..

  • Tests for no crashes due to memory corruption
  • Tests that no tearing occurs in log prints

@IanButterworth IanButterworth added multithreading Base.Threads and related functionality logging The logging framework labels Feb 17, 2025
@IanButterworth IanButterworth changed the title Loggin: test multithreaded logging Logging: test multithreaded logging Feb 17, 2025
@IanButterworth IanButterworth force-pushed the ib/threaded_logging_tests branch 2 times, most recently from 8eed463 to 2db9213 Compare February 17, 2025 23:18
@IanButterworth

This comment was marked as resolved.

@IanButterworth IanButterworth force-pushed the ib/threaded_logging_tests branch from 2db9213 to 5a5fe27 Compare February 18, 2025 12:25
@IanButterworth IanButterworth force-pushed the ib/threaded_logging_tests branch from 5a5fe27 to 349709a Compare February 18, 2025 16:23
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to make the code actually correct first before adding tests for new uses cases which may be unreliable

@IanButterworth
Copy link
Member Author

By "new use cases" do you mean logging from tasks running on other threads?

@vtjnash
Copy link
Member

vtjnash commented Feb 18, 2025

Yes, that has never been allowed before

@IanButterworth
Copy link
Member Author

Ok then I think we need to do two things:

  1. Elaborate the specific issues on Request for clarification on the thread-safety (or lack thereof) of the Julia logging system #57376 as has been requested by people (like myself) that were surprised to hear that logging from threads has always been forbidden and is highly dangerous (even though these test don't shake the bugs out)
  2. Update the docs because as far as I can tell, it doesn't say anywhere that logging from threads is forbidden.

Hopefully we can avoid 2) by just fixing the stuff in 1) first, but I am unaware of the issues, and I believe from slack that you have a private list of issues @vtjnash so it'd be good to make that public.

I'll happily look into fixing this, I just am unfamiliar with the issue(s).

@simsurace
Copy link
Contributor

Yes, that has never been allowed before

Could you confirm that this multi-threaded hello world program is in your opinion a user error:

Threads.@spawn @info "Hello from thread $(Threads.threadid())"

@vtjnash
Copy link
Member

vtjnash commented Feb 19, 2025

Yes, only functions that declare themselves thread-safe may be used

@simsurace
Copy link
Contributor

Since the point of the logging macros is to abstract away the mechanics of how the logs are processed, doesn't an otherwise thread-safe function becoming unsafe by virtue of some logging statements violate expectations for this abstraction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging The logging framework multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants