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

Log::AsyncDispatcher#close not fiber-safe? #13721

Open
xendk opened this issue Aug 1, 2023 · 0 comments
Open

Log::AsyncDispatcher#close not fiber-safe? #13721

xendk opened this issue Aug 1, 2023 · 0 comments
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:concurrency topic:stdlib:log

Comments

@xendk
Copy link
Contributor

xendk commented Aug 1, 2023

I know this is a bit vague, but I believe I ran into: https://github.com/crystal-lang/crystal/blob/a5a617d5499772b1a5bedef70e5dc67ec00bf709/src/log/dispatch.cr#L68C55-L68C55

I'm not clear on how to reproduce, as it doesn't fail in spec, but does when used in a Kemal app. I've implemented my own Log::Backend (which just spreads entries over different files) and it triggers:

Invalid memory access (signal 11) at address 0x100000006
[0x5613ce8fb2c6] *Exception::CallStack::print_backtrace:Nil +118 in ./bin/server
[0x5613ce8ce36e] ~procProc(Int32, Pointer(LibC::SiginfoT), Pointer(Void), Nil) +366 in ./bin/server
[0x7f3d6a468510] ?? +139901752739088 in /lib/x86_64-linux-gnu/libc.so.6
[0x5613ceaf3a83] *Log::AsyncDispatcher#close:Nil +19 in ./bin/server
[0x7f3d6a319c80] ???

Adding super(dispatch_mode: Log::DispatchMode::Sync) to my initialize fixes the problem, so I believe this pin-points the problem to Log::AsyncDispatcher#close, but I don't know why close is called in the first place.

Hopefully someone with deeper insight can figure out what the problem is.

@xendk xendk added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:concurrency topic:stdlib:log
Projects
None yet
Development

No branches or pull requests

2 participants