cetra3 / tmq

Rust ZeroMQ bindings for Tokio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context creation fails on alpine linux

mbuczko opened this issue · comments

I'm not sure if that's a problem of tmq or does it come directly from ZMQ internals, so let me start here first. 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]
# fails on "0.3.0" too
tmq = { git = "https://github.com/cetra3/tmq", branch = "master" }

and it ends up with:

~/sample # ./target/debug/sample
Segmentation fault (core dumped)

Apparently, 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:

~/sample # strace ./target/debug/sample
execve("./target/debug/sample", ["./target/debug/sample"], 0x7ffff95873c0 /* 7 vars */) = 0
mmap(NULL, 344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef29bc5000
arch_prctl(ARCH_SET_FS, 0x7fef29bc5090) = 0
set_tid_address(0x7fef29c39b30)         = 72419
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=0x7fef29c12f1d}, {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=0x7fef29beb240, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fef29c12f1d}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x7fef29beb240, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7fef29c12f1d}, 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) = 0x7fef29bc2000
mprotect(0x7fef29bc2000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0x7fef29bc3000, ss_flags=0, ss_size=8192}, NULL) = 0
brk(NULL)                               = 0x5555573b1000
brk(0x5555573b3000)                     = 0x5555573b3000
mmap(0x5555573b1000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x5555573b1000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fef29bc1000
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=0x7fef29c12f1d}, NULL, 8) = 0
rt_sigreturn({mask=[]})                 = 140665174578032

Some more details:

~/sample # 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).

Does this break on the standard ZeroMQ crate as well: https://github.com/erickt/rust-zmq

yes, it breaks using only this crate too. I should have checked that before.

I'm closing this ticket and moving discussion to rust-zmq.