0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 23:01:04 +08:00

1115 Commits

Author SHA1 Message Date
E. G. Patrick Bos
36e4c9b474
add zmq_ppoll
zmq_ppoll mostly mimics zmq_poll behavior, except for the added feature of being able to specify a signal mask. Signals in this mask will be blocked during execution of zmq_ppoll. Switching of the process' active signal mask happens atomically with the actual poll call, so that no race conditions can occur. This behavior is useful when one wants to gracefully handle POSIX signals without race conditions. See e.g. the discussion below https://250bpm.com/blog:12/ for an explanation.

Also includes two new tests:
1. test_zmq_ppoll_fd does the same thing as test_zmq_poll_fd, demonstrating backwards compatibility with zmq_poll when used with a default signal mask.
2. test_zmq_ppoll_signals demonstrates the use of zmq_ppoll with a signal mask, blocking out SIGTERM everywhere except in zmq_ppoll, allowing to handle the signal in one place without having to worry about race conditions.
2021-09-24 11:04:20 +02:00
Luca Boccassi
6f200814cd Problem: some tests occasionally fail on OBS
Solution: ignore them
2021-09-22 16:42:09 +01:00
Luca Boccassi
2a954b301e Problem: test_security_curve always fails when run by CMake under Github Actions
Solution: skip it
2021-09-22 16:42:09 +01:00
Luca Boccassi
e3d37a82e1 Problem: some tests time out in CI under Valgrind
Solution: triple the timeouts
2021-09-22 16:40:17 +01:00
Luca Boccassi
0f706bdd97 Problem: formatting errors
Solution: run make clang-format-diff
2021-09-22 16:40:17 +01:00
Luca Boccassi
11f0802912 Problem: VMCI might not be supported by CI
Solution: skip tests if zmq_bind fails with EAFNOSUPPORT
2021-09-22 16:40:17 +01:00
Luca Boccassi
37c548d62b Problem: test_pair_tcp_cap_net_admin requires privileges and might fail
Solution: skip it if EOPNOTSUPP is returned instead of failing
2021-09-22 16:40:17 +01:00
Luca Boccassi
de03c9a6ab Problem: test_inproc_connect occasionally fails on slow archs
Solution: actually send a message rather than just opening/closing
the sockets, as connecting is asynchronous.

tests/test_inproc_connect.cpp:341:test_bind_before_connect:PASS
tests/test_inproc_connect.cpp:342:test_connect_before_bind:PASS
tests/test_inproc_connect.cpp:343:test_connect_before_bind_pub_sub:PASS
tests/test_inproc_connect.cpp:344:test_connect_before_bind_ctx_term:PASS
tests/test_inproc_connect.cpp:345:test_multiple_connects:PASS
tests/test_inproc_connect.cpp:346:test_multiple_threads:PASS
Assertion failed: _state == active || _state == waiting_for_delimiter (src/pipe.cpp:504)
0  0xffffa015d3e4 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::zmq_abort(char const*)+0xc)
1  0xffffa017b208 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::pipe_t::process_delimiter()+0xb0)
2  0xffffa017b420 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::pipe_t::read(zmq::msg_t*)+0xd8)
3  0xffffa01a4b28 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::xpub_t::xread_activated(zmq::pipe_t*)+0x110)
4  0xffffa01a3758 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::xpub_t::xattach_pipe(zmq::pipe_t*, bool, bool)+0x68)
5  0xffffa018dc3c in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::socket_base_t::attach_pipe(zmq::pipe_t*, bool, bool)+0x94)
6  0xffffa016f288 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::object_t::process_command(zmq::command_t const&)+0x148)
7  0xffffa014ee3c in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t*, zmq::options_t const&, zmq::ctx_t::pending_connection_t const&, zmq::ctx_t::side)+0xdc)
8  0xffffa0150bec in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::ctx_t::connect_pending(char const*, zmq::socket_base_t*)+0x1fc)
9  0xffffa0190034 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (zmq::socket_base_t::bind(char const*)+0x3e4)
10  0xaaaae50475d8 in /usr/src/packages/BUILD/tests/.libs/test_inproc_connect (simult_bind(void*)+0x28)
11  0xffffa019bfb8 in /usr/src/packages/BUILD/src/.libs/libzmq.so.5 (thread_routine+0x70)
12  0xffffa00e07e4 in /lib/aarch64-linux-gnu/libpthread.so.0 (start_thread+0x18c)
13  0xffff9fdcab2c in /lib/aarch64-linux-gnu/libc.so.6 (clone+0x5c)
2021-06-14 11:43:06 +01:00
Doron Somech
1c6c5514ed problem: no way to know when connection is temporarly dropped
This is important in order to send the login sequence of a client to the server.

Solution: add ZMQ_HICCUP_MSG to a socket, socket would send that message whenever a connection get temporarly disconnected
2021-06-06 17:14:22 +03:00
Chengye Ke
04c37982b1
Support so_busy_poll (#4188)
* Support so_busy_poll.
2021-05-14 23:05:56 +01:00
Luca Boccassi
b4f758da35
Merge pull request #4174 from jlsantiago0/build-fix-bsd
Fix Build BSD
2021-04-15 23:16:33 +01:00
Jose Santiago
7d8b149681 Fix Build BSD
This fixes build under BSD. Tested with OpenBSD-6.4 and FreeBSD-11.3.
2021-04-15 14:04:27 -05:00
Jose Santiago
235654697f MINGW Build Fix.
There is a macro that redefines claose to closesocket, but then close is
later defined in unistd.h which is included in testutil_unity.cpp which
then causes the regular close() prototype to be defined with the new
function name closesocket which does not match the signature of the
original closesocket in winsock2.h from the toolchain.

We can work around this issue, by making sure that unistd.h is included
before the macro is defined. HMM> Yes macro substitution is the root of
evil.
2021-04-15 12:53:02 -05:00
Luca Boccassi
8fe5b54b8a Problem: VMCI build broken
Solution: refactor it
2021-02-21 11:50:38 +00:00
Luca Boccassi
16af1bd622 Problem: test_pubsub broken everywhere
Solution: disable it
2021-01-18 09:42:33 +00:00
mjvankampen
2dd24d6d80
Problem: norm fails to compile under windows (#4123)
* Makes norm useable (but maybe slow) on windows
2021-01-18 08:42:14 +00:00
Luca Boccassi
2347a76413 Problem: build broken on debian/hurd
Solution: fix it
2021-01-16 17:48:29 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* Problem: No direct support for setting socket priority

Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
2021-01-06 22:22:41 +00:00
Luca Boccassi
41c4ce1817 Problem: ZMQ_PUB broken on ZMQ_WS
Solution: encode subscribe/cancel messages until there are appropriate
opcodes.
Regression introduced by 253e9dd27b3d7c0d736d4fa3802e87d00bd915c9

Fixes https://github.com/zeromq/libzmq/issues/4101
2020-12-23 17:44:07 +00:00
Luca Boccassi
d77c60a0db Problem: tests fails to receive with EAGAIN on slow architectures
Solution: remove arbitrary timeouts, as they are testing reliable pipes
with no contention, so if it can connect eventually it has to
work. The overall test timeout covers cases where it doesn't.

If tests want to use receive timeouts, they need to handle EAGAIN
properly.
2020-11-18 13:29:33 +00:00
Luca Boccassi
792ffe4d7a Problem: zmq_ctx_get API broken
Solution: restore EINVAL as errno on unknown option.
Broken by https://github.com/zeromq/libzmq/pull/3642 which started to
return EFAULT instead
2020-09-10 22:37:01 +01:00
Luca Boccassi
e708623c12 Problem: no fuzzing coverage for ZMQ_STREAM
Solution: add tests
2020-09-06 11:05:15 +01:00
Simon Giesecke
2741e93361 Problem: no test for (invalid) too long ipc endpoint name
Solution: add test
2020-09-05 13:17:13 +02:00
Simon Giesecke
90d5cf29d8 Problem: no test for (invalid) empty abstract ipc endpoint name
Solution: add test
2020-09-05 13:17:13 +02:00
Simon Giesecke
c6301206dc Problem: no tests for ZMQ_TCP_ACCEPT_FILTER
Solution: add some tests
2020-09-04 15:51:33 +02:00
Luca Boccassi
5b0956c381 Problem: test_socket_options_fuzzer does not work
Solution: fix it
2020-08-22 17:01:10 +01:00
Luca Boccassi
6386bc13d3 Problem: test_socket_options_fuzzer can pass non-NUL terminated data buffers
Solution: ensure they are valid strings
2020-08-21 16:23:24 +01:00
Luca Boccassi
f43013a7d1 Problem: no fuzz testing for options
Solution: add it
2020-08-21 15:25:55 +01:00
Luca Boccassi
64a575eede Problem: test_bind_ws_fuzzer needs DRAFT sockets
Solution: use ZMQ_DEALER instead
2020-08-21 14:39:08 +01:00
Luca Boccassi
eb9118f0c9 Problem: no fuzz testing for websockets
Solution: add tests for plain WS
2020-07-05 23:43:58 +01:00
Luca Boccassi
e95e57d385 Problem: fuzzer corpus file can be quite large
Solution: move all corpora to the zeromq/libzmq-fuzz-corpora repository
for easier handling, and to avoid inflating the size of zeromq/libzmq.
Clone it for the CI on the fly.
2020-07-04 17:50:35 +01:00
Luca Boccassi
5c5e279108 Problem: test_req_relaxed occasionally fails
Solution: instead of relying on timing to get the order
of connected rep sockets just right, wait for each connection
2020-06-27 21:57:29 +01:00
Luca Boccassi
1ddfeb56ec Problem: formatting errors
Solution: run make clang-format-diff
2020-06-26 23:45:39 +01:00
Bill Torpey
c04f6581e0
rebase reconnect-redux on master (#3960)
* add option to stop reconnecting on failed handshake
2020-06-26 23:41:44 +01:00
Luca Boccassi
3856027da9 Problem: test_bind_fuzzer does not build on OSX
Solution: use POSIX API instead of GNU extension
2020-06-15 23:47:35 +01:00
Luca Boccassi
1ffc21d378 Problem: test_bind_fuzzer clobbers working directory with random socket files
Solution: move to /tmp before running the test
2020-06-07 12:09:17 +01:00
Luca Boccassi
35c4c22c81 Problem: z85 decode test might not always get valid input and pass
Solution: do not fail the test in that case, what's important is checking
for undefined behaviour
2020-05-24 14:26:14 +01:00
Luca Boccassi
85e198c5b4 Problem: wrong testcase name in z85_decode_fuzzer
Solution: fix it
2020-05-21 11:31:24 +01:00
Luca Boccassi
1ac753979a Problem: z85_decode fuzzer does not run regression tests with corpora
Solution: do it to avoid regressions
2020-05-21 10:49:55 +01:00
Luca Boccassi
51c90a6cd5 Problem: z85_decode fuzzer fails if fewer than 5 bytes are passed
Solution: check immediately the size of the input
2020-05-21 10:49:55 +01:00
Luca Boccassi
2d23b599f2 Problem: test_bind_fuzzer does not use corpus for regression tests
Solution: do it
2020-05-16 15:01:15 +01:00
Luca Boccassi
6439d32254 Problem: fuzz tests do not check that legitimate clients work
Solution: add normal client sockets and bounce at the same time as
the mock client
2020-05-15 18:19:38 +01:00
Doron Somech
ad3b36ab95 problem: test_xpub_manual is flapping
The test assumed the subscriptions are arrived in some order, but occasionally the order is not as expected

Solution: fix it
2020-05-14 00:01:06 +03:00
Doron Somech
e7f0090b16 problem: zeromq connects peer before handshake is completed
Solution: delay connecting the peer pipe until the handshake is completed
2020-05-13 19:36:13 +03:00
Luca Boccassi
fb9d055578 Problem: test_bind_curve_fuzzer might get stuck on some input
Solution: receive with MSG_DONTWAIT on the raw TCP socket
2020-05-09 13:17:36 +01:00
Luca Boccassi
abb315a6da Problem: potential memory leak in test_connect_curve_fuzzer
Solution: properly initialize zmq_msg before receive
2020-05-09 12:31:36 +01:00
Doron Somech
3da84c6d06 problem: no thread-safe alternative for ZMQ_PAIR
Solution: create ZMQ_CHANNEL, the thread safe alternative
2020-05-09 08:49:01 +03:00
Luca Boccassi
98efa79f54 Problem: ZMQ_DISABLE_TEST_TIMEOUT does not work anymore
Solution: restore it so that it can be set via CPPFLAGS, to avoid
tests timing out when running in GDB
2020-05-08 18:18:34 +01:00
Luca Boccassi
5fd0711196 Problem: memory leak in test_connect_null_fuzzer
Solution: initialize message before re-using it so that
receive doesn't fail and messages can be deallocated
2020-05-06 22:26:03 +01:00
Luca Boccassi
243503c29e Problem: set infinite timeouts on some tests by mistake
Solution: remove it
2020-05-06 20:56:36 +01:00