Commit Graph

108 Commits

Author SHA1 Message Date
Alessio M
9066e0670f Problem: stack overflow on win64 #2876. Basically zmq::signaler_t::wait suffers from stack bloating the same way socket_poller was found to be bloated due to the large size of fd_set
Solution: replace the fd_set in the routine with an instance of optimized_fd_set_t
2018-06-28 14:11:32 +01:00
Simon Giesecke
9e6f1c9a3c Problem: redundant else after return
Solution: remove redundant else
2018-05-30 23:21:52 +02:00
Simon Giesecke
2da6629e0f Problem: Magic numbers "1" and "100" in signaler.cpp
Solution: introduced constants, use std::min/std::max instead of control structures
2018-05-28 17:53:43 +02:00
Simon Giesecke
e3c73d9881 Problem: inconsistent naming style for private data members, conflicts with naming of local variables and member functions
Solution: apply and check _lower_case naming style for private data members
2018-05-27 13:24:07 +02:00
Simon Giesecke
4e616f30dd Problem: C-style casts used
Solution: replace by C++-style casts
2018-05-18 17:04:01 +02:00
Simon Giesecke
c52871f82c Problem: C4627 warning in proxy.cpp and signaler.cpp
Solution: move conditional include directive to precompiled.hpp
2018-05-14 18:07:13 +02:00
Manuel Segura
4726f7262d Pull request to merge porting to WindRiver VxWorks 6.x (#2966)
* Problem: Still need to port over more files to VxWorks 6.x

Solution: Port more files to VxWorks 6.x

* Problem: Need to port over remaining files to VxWorks 6.x. Also remove POSIX thread dependency for VxWorks (because of priority inversion problem in POSIX mutexes with VxWorks 6.x processes)

Solution: Port over remaining files to VxWorks 6.x. Also removed POSIX thread dependency for VxWorks

* Problem: Needed to modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x.

Solution:  Modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x
2018-03-10 11:03:02 +00:00
Simon Giesecke
e8e24030ea Problem: network initialization and shutdown functions not available for
reuse

Solution: extract into functions defined in ip.hpp

Problem: signaler_t::make_fdpair not reusable

Solution: move make_fdpair to ip.hpp

Problem: epoll worker with no fds cannot be stopped

Solution: use interruptible epoll_pwait call

Problem: insufficient unit tests for poller

Solution: add test cases
2018-02-13 18:38:17 +01:00
Simon Giesecke
a5e763039d Problem: use of TCP loopback fastpath not available for user sockets
Solution: add socket option
2018-02-09 14:22:42 +01:00
sigiesec
490d76da2f Problem: SIO_LOOPBACK_FAST_PATH not activated for signaler socket pair
Solution: activate SIO_LOOPBACK_FAST_PATH if available

See #2899
2018-02-09 13:50:40 +01:00
sigiesec
368eff9ecb Problem: several fields are non-const without need
Solution: add const where easily possible
2018-02-08 22:17:03 +01:00
sigiesec
41f459e1dc Problem: formatting inconsistent
Solution: applied clang-format
2018-02-02 15:47:43 +01:00
sigiesec
206c832167 Problem: in case of exhausted resources on creation of a context, assertions are triggered
Solution: signal error to caller, and apply appropriate cleanup
2018-01-31 20:53:06 +01:00
bbdb68
1d58a00992 Problem: no windows UWP support
* add define for windows/UWP

* prevent issue with COM references

* gettickcount not available on uwp

* add compiler definitions

* add convenitnece cmake file

* brute force uwp compilation

* fix compiler version

* cosmetics
2017-04-04 09:50:33 +01:00
Thomas Braun
33e29bd383 Problem: Out of memory condition not always checked
Solution: Use the appropriate assertion macro.
2017-03-27 23:58:38 +02:00
nexcvon
9624f9ade7 Problem: zmq::signaler_t::send may loop forever
Solution: restore the wsa_assert statement previously removed.
2017-03-06 21:55:30 +08:00
nexcvon
bcf75777c8 Problem: Assertion failed in zmq::signaler_t::send
Solution: Change to the way it does below on non-Windows platforms, retry when send returns -1.
2017-03-03 19:00:58 +08:00
Luca Boccassi
6e708ce144 Problem: socketpair leaks file on fork+exec
Solution: if available, call socketpair with SOCK_CLOEXEC flag to
make the process close the socket on fork+exec
2016-12-26 19:13:02 +01:00
Luca Boccassi
f287c7a2aa Problem: eventfd leaks socket on fork+exec
Solution: if available, use eventfd with EFD_CLOEXEC flag to make
the process close the socket on fork+exec
2016-12-26 19:08:27 +01:00
Luca Boccassi
57db5f2a5c Problem: 4.2.0 won't compile on AIX 7.1
Solution: restore inclusion of poll.h if using poll before zmq.h as
it was originally, as AIX redefines the POSIX structures and provides
compatibility macros.
Also add alternative aliases for 32 bit AIX's pollitem struct:
  events -> reqevents
  revents -> rtnevents
2016-12-05 22:50:10 +00:00
Constantin Rack
022cf2aeaa Problem: source code contains tabs
Solution: replace tabes with spaces
2016-09-17 08:44:00 +02:00
Michael Lutz
7a6ff07a01 Problem: Windows performance is not optimal due to select().
Solution: Provide poll() for Windows as well. This is a build option that
defaults to off as the resulting binary will only run on Windows Vista or
newer.

This is not tested with alternative Winsock service providers like VMCI,
but the documentation for WSAPoll does not mention limitations.

On my local machine, throughput improves by ~10 % (20 simultaneous
remote_thr workes to one local_thr, 10 byte messages), while latency
improves by ~30 % (measured with remote/local_lat).
2016-06-11 19:17:18 +02:00
evoskuil
2b798e486a Problem: name conflicts from windows.h, draft API declared in pch. 2016-05-13 20:41:26 -07:00
hitstergtd
9218441f97 Problem: unistd.h redundantly included twice
Solution: fix it
2016-04-26 16:57:30 +01:00
Luca Boccassi
d4c0716473 Problem: indentation should be 4 spaces, no tabs
Solution: fix it
2016-02-21 23:16:44 +00:00
Osiris
b3d5fa63a0 Problem: Several problems found by Coverity Static Analyzer
Solution: The Coverity Static Code Analyzer was used on libzmq code and found
many issues with uninitialized member variables, some redefinition of variables
hidding previous instances of same variable name and a couple of functions
where return values were not checked, even though all other occurrences were
checked (e.g. init_size() return).
2016-02-21 15:49:47 -06:00
Osiris
4a5af9d58b Problem: Precompiled headers not being used
Solution: Phase I - make precompiled.hpp be first file included in every source file
2016-02-18 10:56:52 -06:00
Constantin Rack
a539b0c6e8 Problem: copyright year is still 2015
Solution: update to 2016
2016-01-28 15:07:31 +01:00
Pieter Hintjens
54e2e2a7ad Problem: Windows 7 TCP slow start
See issue #1608.

This is an old issue with Windows 7. The effect is that we see a latency
ramp on the first 500 messages.

* The ramp is unaffected by message size.
* Sleeping up to 100msec between sends has no effect except to switch
    off ZeroMQ batching so making the ramp more visible.
* After 500 messages, latency falls back down to ~10-40 usec.
* Over inproc:// the ramp happens when we use the signaler class.
* Client-server over inproc:// does not show the ramp.
* Client-server over tcp:// shows a similar ramp.

We know that the signaller is using TCP on Windows. We can 'prime' the
connection by doing 500 dummy sends. This potentially causes new sockets
to be delayed on creation, which is not a good solution.

Note that the signaller sends zero-byte messages. This may also be
confusing TCP.

Solution: flood the receive buffer when creating a new FD pair; send a
1M buffer and discard it.

Fixes #1608
2015-11-01 12:57:53 +01:00
Pieter Hintjens
f38c11c063 Whitespace fixes 2015-10-30 10:22:05 +01:00
KIU Shueng Chuan
596d6e5b1c create signaler::recv_failable()
In real world usage, there have been reported signaler failures where the
eventfd read() or socket recv() system call in signaler::recv() fails,
despite having made a prior successful signaler::wait() call.

this patch creates a signaler::recv_failable() method that allows
unreadable eventfd / socket to return an error without asserting.
2015-09-29 09:14:02 +08:00
Maxim Yakhontov
e9e03f5ade fixed zmq assertion in signaler.cpp under ubuntu 2015-09-18 20:48:08 +06:00
Constantin Rack
bd923f0fbb Problem: some comments contain typos 2015-09-06 18:46:32 +02:00
Constantin Rack
2159618b56 Revert "Solution: check return code of make_fdpair() with zmq_assert" 2015-09-03 10:56:26 +02:00
Constantin Rack
bb9788867f Problem: return code of make_fdpair() is not checked. Fixes #1558 2015-09-02 23:19:27 +02:00
Brian Silverman
62a0e45089 Fix eventfd read handling under heavy load.
I had the assertion below fail occasionally when running the libzmq
tests under heavy CPU load on linux 3.16.0-4-amd64.
2015-07-28 13:48:36 -07:00
Richard Newton
91877a22d7 Fix windows build 2015-07-23 08:49:03 +01:00
Giulio Eulisse
e2be0d25bd Fix compilation on mac. 2015-07-22 21:31:48 +02:00
Brian Silverman
773a06fc23 Fix memory leak when creating a socket fails.
Previously, AddressSanitizer flagged leaks when running
tests/test_many_sockets.cpp.
2015-07-22 11:18:48 -07:00
Pieter Hintjens
8620c3e032 Problem: source file headers are somewhat confusing about LGPLv3
Of course people still "can" distributed the sources under the
LGPLv3. However we provide COPYING.LESSER with additional grants.

Solution: specify these grants in the header of each source file.
2015-06-02 22:33:55 +02:00
Pieter Hintjens
594e3dcceb Problem: shutdown asserts if WSASTARUP wasn't done previously
This is a silly assertion that causes problems if libzmq.dll is
called in some esoteric ways.

Solution: if the shutdown code detects WSANOTINITIALISED, then
exit silently.

Fixes #1377
Fixes #1144
2015-04-20 12:53:37 +02:00
Pieter Hintjens
94d9a4ffdf Problem: copyright statements are out of date
Solution: update for 2015

Fixes #1320
2015-01-22 10:32:37 +01:00
Michaël Paul
7c5906d138 Problem : Build failed with MinGW on windows 2014-09-24 15:46:43 +02:00
Ewen McNeill
0af693c496 z/OS: Loop on EAGAIN on close() in ~signaler
Updated:
    src/signaler.cpp: Add close_wait_ms() static function to loop
       when receiving EAGAIN in response to close(), with ms long
       sleeps, up to a maximum limit (default 2000ms == 2 seconds);
       used in signaler_t::~signaler_t() destructor.
2014-07-23 14:01:43 +12:00
Martin Hurton
816299f11c Code cleanup 2014-07-09 14:07:32 +02:00
Richard Newton
bbaa85e7dd Fix windows non-unicode build 2014-04-27 13:29:20 +01:00
evoskuil
ca29709f38 Change TCHAR to Unicode, use safe swprintf to remove warning. 2014-04-25 00:43:47 -07:00
evoskuil
86ef40d171 Reorganize and clean up visual studio build configurations. 2014-03-29 23:13:00 -07:00
Frank
8edc80f27b cmake: fix fragile code related to HAVE_FORK macro
* report from Richard Newton indicated previous solutions was not
  working on Windows
2014-03-18 21:07:45 +01:00
Olaf Mandel
48b50cefb4 Remove duplicate poller decision making
The decision about the poller mechanism to use (select, poll, ...)
was done twice: once by the build system and once by the code in
poller.hpp. As the build-system can actually detect the mechanisms
available, prefer that result to the hard coded defaults in
poller.hpp.

At the same time, remove the duplicate detection of select() vs.
poll()-variant from proxy.cpp, signaler.cpp and zmq.cpp.

This patch has not been tested on many build platforms: especially
the cmake build needs testing / patching. For the other builds,
hard code the result as these these are all Windows platforms.
2014-02-17 14:08:11 +01:00