Commit Graph

94 Commits

Author SHA1 Message Date
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
Pieter Hintjens
b3b9e046ee Updated copyright statements for 2014 2014-01-02 12:00:57 +01:00
KIU Shueng Chuan
7f22995e35 use mutex implementation if fixed signaler_port!=5905 2013-12-12 00:39:01 +08:00
KIU Shueng Chuan
bd41087ab9 make win32 signaler support ephemeral ports 2013-11-28 18:25:28 +08:00
KIU Shueng Chuan
7bd0b6ada1 remove all asserts during critical section
the size of the critical section is reduced by only entering the critical
section right before the bind().
2013-11-12 01:12:24 +08:00
KIU Shueng Chuan
cf8ba925b4 return error to caller on bind error 2013-11-12 00:07:06 +08:00
Bruno D. Rodrigues
750426037d Fix socket creation above sistem limits for all 'other' OS not covered by eventfd, windows or vms; enhanced test to create sockets up to a bigger limit to really test hitting the OS limit 2013-11-10 10:19:19 +00:00
Pieter Hintjens
51f8571933 Simplified fdpair reset after fork 2013-11-07 15:30:25 +01:00
Pieter Hintjens
2be70dca1a Simplified error handling for make_fdpair on Windows 2013-11-07 15:26:56 +01:00
Pieter Hintjens
c573f6b812 Fix for issue 574 2013-11-07 14:59:53 +01:00
Matt Connolly
c3adc86d6b Fix unused variable when using eventfd 2013-09-02 06:49:30 +10:00
Matt Connolly
ff2900fd52 Terminate context in a child process of fork() to replace file descriptors to not interfere with parent process's context 2013-09-01 20:42:15 +10:00
Pieter Hintjens
f0f16505e5 Removed corporate advertisements from source file headers
Copyrights had become ads for Sustrik's corporate sponsors, going against the original
agreement to share copyrights with the community (that agreement was: one line stating
iMatix copyright + one reference to AUTHORS file). The proliferation of corporate ads
is also unfair to the many individual authors. I've removed ALL corporate title from
the source files so the copyright statements can now be centralized in AUTHORS and
source files can be properly updated on an annual basis.
2013-03-12 13:24:57 +01:00
Sébastien Rombauts
57f84d6811 Windows CE support : some more #if !defined _WIN32_WCE
- Windows CE does not manage security attributes (no SetSecurityDescriptorDacl(), SetEvent (NULL, xxx) ...)
- Windows CE does not inheritance of sockets for child process (SetHandleInformation ((HANDLE) *w_, HANDLE_FLAG_INHERIT...)
- see comments about story "Porting ZeroMQ to Windows Mobile" on webpage http://www.zeromq.org/story:5
2013-02-19 18:57:12 +01:00
KIU Shueng Chuan
8c71ac47e8 release critical section on failure to create signaler fdpair 2013-02-15 10:45:43 +08:00