use tmq::{Context, publish::publish};
fn main() -> anyhow::Result<()> {
let url = "tcp://127.0.0.1";
let context = Context::new();
let _pub_socket = publish(&context).bind(url)?;
Ok(())
}
Try under docker with:
docker run -w $(pwd) -v $(pwd):$(pwd) -it --rm almalinux:10 bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.bashrc
dnf install g++
cargo run
Some analysis (I think ZMQ access an unaligned address).
$ cargo build && gdb --args ./target/debug/program
...
>>> bt
#0 0x00005555555a13fa in zmq::ypipe_t<zmq::command_t, 16>::write (this=0x5555556acbe8, value_=...,
incomplete_=false)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/ypipe.hpp:77
#1 0x00005555555a0e76 in zmq::mailbox_t::send (this=0x5555556acbe0, cmd_=...)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/mailbox.cpp:62
#2 0x00005555555929c5 in zmq::ctx_t::send_command (this=0x5555556a7d10, tid_=3, command_=...)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/ctx.cpp:664
#3 0x00005555555a414f in zmq::object_t::send_stop (this=0x5555556ac380)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/object.cpp:226
#4 0x00005555555b1dba in zmq::socket_base_t::stop (this=0x5555556ac380)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/socket_base.cpp:317
#5 0x0000555555591b1c in zmq::ctx_t::terminate (this=0x5555556a7d10)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/ctx.cpp:200
#6 0x00005555555903fd in zmq_ctx_term (ctx_=0x5555556a7d10)
at /home/dan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zeromq-src-0.2.6+4.3.4/vendor/src/zmq.cpp:157
#7 0x000055555558e6a2 in zmq::RawContext::term (self=0x5555556a83f0) at src/lib.rs:383
#8 0x000055555558e6e2 in zmq::{impl#10}::drop (self=0x5555556a83f0) at src/lib.rs:393
#9 0x000055555558effb in core::ptr::drop_in_place<zmq::RawContext> ()
at /home/dan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:799
#10 0x000055555558da02 in alloc::sync::Arc<zmq::RawContext, alloc::alloc::Global>::drop_slow<zmq::RawContext, alloc::alloc::Global> (self=0x7fffffffd818)
at /home/dan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1943
#11 0x000055555558dbcd in alloc::sync::{impl#38}::drop<zmq::RawContext, alloc::alloc::Global> (
self=0x7fffffffd818)
at /home/dan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2686
#12 0x000055555558f11b in core::ptr::drop_in_place<alloc::sync::Arc<zmq::RawContext, alloc::alloc::Global>> ()
at /home/dan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:799
#13 0x000055555558efeb in core::ptr::drop_in_place<zmq::Context> ()
at /home/dan/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:799
#14 0x0000555555579562 in bla::main () at src/main.rs:9
0x00005555555a13ec ? call 0x5555555a17ae <_ZN3zmq8yqueue_tINS_9command_tELi16EE4backEv>
0x00005555555a13f1 ? mov 0x10(%rsp),%rdx
0x00005555555a13f6 ? vmovdqa (%rdx),%ymm0
0x00005555555a13fa ? vmovdqa %ymm0,(%rax)
0x00005555555a13fe ? vmovdqa 0x20(%rdx),%ymm0
0x00005555555a1403 ? vmovdqa %ymm0,0x20(%rax)
0x00005555555a1408 ? mov 0x18(%rsp),%rax
>>> i r
rax 0x5555556acc90 93824993643664
rbx 0x0 0
rcx 0x5555556acbe8 93824993643496
rdx 0x7fffffffd500 140737488344320
rsi 0x7fffffffd500 140737488344320
rdi 0x5555556acbf0 93824993643504
rbp 0x7fffffffd450 0x7fffffffd450
rsp 0x7fffffffd430 0x7fffffffd430
r8 0x1 1
r9 0x3f 63
r10 0x3 3
r11 0x0 0
r12 0x1000 4096
r13 0x7fffff7ff000 140737479962624
r14 0x0 0
r15 0x7fffffffdc88 140737488346248
rip 0x5555555a13fa 0x5555555a13fa <zmq::ypipe_t<zmq::command_t, 16>::write(zmq::command_t const&, bool)+50>
eflags 0x10206 [ PF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
fs_base 0x7ffff7ec5780 140737352849280
gs_base 0x0 0
Try under docker with:
Some analysis (I think ZMQ access an unaligned address).