-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
zmq::thread_t::applySchedulingParameters() crash with musl-libc. #3162
Comments
Are there pre-built toolchains with musl? Simply statically linking to musl and with a glibc gcc/stdlibc++ does not reproduce the problem, and I don't have time to re-bootstrap from scratch |
x86_64-unknown-linux-musl.tar.xz |
I can't reproduce the problem, both the example program and all the tests run just fine. This is on Debian Sid as a host. |
I got SIGSEGV while running the example program under GDB. |
Ah yes I can reproduce it with gdb - strange. Feel free to send a PR to fix it. |
I just ran into this same issue with a zerorpc client under Alpine. It's pretty easy to reproduce by just repeatedly running the equivalent of that code above (but in my case via the zerorpc python wrapper). Any idea of when this fix make it into an official release ? |
Soon-ish |
Hi, I got this trace on a buildroot linux x64 system using musl 1.2.2 toolchain (http://www.musl-libc.org/releases/musl-1.2.2.tar.gz) with zeromq 4.3.4 and 5.4.31 kernel:
src/thread.c (lines 308-309) 308: int rc = pthread_getschedparam (pthread_self (), &policy, ¶m);
309: posix_assert (rc); posix_assert is being triggered because pthread_getschedparam returns with ESRCH : Thus the workaround implemented in b0d9a5a isn't working anymore in latest MUSL dependent systems. My guess is that we're now facing a MUSL related bug. Where should we inform MUSL developers about this possible race between pthread_create in main thread and pthread_getschedparam using pthread_self() in secondary thread? |
Tried using the exact same environment, but with MUSL 1.1.24 instead of 1.2.2 -> working fine, no crash and zeromq behaves correctly With this I'm pretty confident that the regression has been introduced in 1.2.X MUSL series. |
Anyone knows how to reach out to MUSL? |
Issue description
zmq::thread_t::applySchedulingParameters() call to some pthread functions using the descriptor member, which may be uninitialized if the new thread start before pthread_create return (musl-libc's pthread_create set the descriptor after starting the thread, while glibc just works beacuse the descriptor was set before the thread starts). May be use pthread_set() instead for compatibility?
Environment
Minimal test code / Steps to reproduce the issue
What's the actual result? (include assertion message & call stack if applicable)
SIGSEGV.
What's the expected result?
Exit normally.
The text was updated successfully, but these errors were encountered: