rust-zmq: Context creation fails on alpine linux
Hey, I’m trying to run as simple code as possible in alpine:latest
container:
use tmq::Context;
fn main() {
Context::new();
}
Cargo.toml:
[package]
name = "sample"
version = "0.1.0"
edition = "2018"
[dependencies]
zmq = "0.9"
and it painfully dies with core dump:
~/sample # ./target/debug/sample
Segmentation fault (core dumped)
There is something weird happening during context creation which leads to the core dump. I tried to strace it a bit, but still no idea what’s the root cause:
~ # strace ./target/debug/sample
execve("./target/debug/sample", ["./target/debug/sample"], 0x7ffc5ff82360 /* 7 vars */) = 0
mmap(NULL, 368, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd152c5d000
arch_prctl(ARCH_SET_FS, 0x7fd152c5d090) = 0
set_tid_address(0x7fd152cd0da0) = 345
poll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, 0) = 0 (Timeout)
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fd152caaa00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x7fd152c83240, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fd152caaa00}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x7fd152c83240, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fd152caaa00}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fd152c5a000
mprotect(0x7fd152c5a000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0x7fd152c5b000, ss_flags=0, ss_size=8192}, NULL) = 0
brk(NULL) = 0x5555571be000
brk(0x5555571bf000) = 0x5555571bf000
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1 RT_2], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
rt_sigaction(SIGSEGV, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fd152caaa00}, NULL, 8) = 0
rt_sigreturn({mask=[]}) = 140537014043504
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
Rustc details:
~ # rustc --version
rustc 1.59.0-nightly (78fd0f633 2021-12-29)
(fails with alpine packaged rust too). libzmq installed from alpine package (apk add libzmq
), though I tried with self compiled version too - same result.
Any hint what might be the root cause of this problem?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15
This is great. It’s a holiday where i’m from right now, but on Monday i’ll create a PR with an update to the readme to let people who run into this problem know about this solution, or you may do so yourself. Once that’s done i’m sure the issue can be closed and the bounty will be sent. Thank you for all your hard work!
I have created an example for this issue: https://github.com/daniel-brenot-apcapital/example-zmq