Commit Graph

4148 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
a8c1136de2 2015.09.23, Version 1.7.5 (Stable)
Changes since version 1.7.4:

* unix: Support atomic compare & swap xlC on AIX (nmushell)

* unix: Fix including uv-aix.h on AIX (nmushell)

* unix: consolidate rwlock tryrdlock trywrlock errors (Saúl Ibarra
  Corretgé)

* unix, win: consolidate mutex trylock errors (Saúl Ibarra Corretgé)

* darwin: fix memory leak in uv_cpu_info (Jianghua Yang)

* test: add tests for the uv_rwlock implementation (Bert Belder)

* win: redo/fix the uv_rwlock APIs (Bert Belder)

* win: don't fetch function pointers to SRWLock APIs (Bert Belder)
2015-09-22 22:12:07 +02:00
Bert Belder
98239224c3 win: don't fetch function pointers to SRWLock APIs
They're no longer needed, since the Windows-native SRWLock functions are
no longer used.

PR-URL: https://github.com/libuv/libuv/pull/525
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-22 11:18:23 -04:00
Bert Belder
9a4fd2689d win: redo/fix the uv_rwlock APIs
Previously, on Windows Vista and later, we'd use the Windows native
SRWLock APIs. However they turned out to be semantically incompatible
with pthread read-write locks and/or plain buggy. This patch makes sure
that the custom implementation that was previously only used on old
Windows versions is now used everywhere.

This patch fixes a number of issues with the old fallback
implementation. Specifically:

* The reader count would not be incremented when a thread successfully
  acquired a read lock while another thread *also* held a read lock.

* `uv_rwlock_tryrdlock()` and `uv_rwlock_trywrlock()` now
  consistently return UV_EBUSY when a lock couldn't be acquired.

* Any unexpected errors now cause libuv to abort, with the exception of
  `uv_rwlock_init()`.

See also https://github.com/libuv/libuv/issues/515.

PR-URL: https://github.com/libuv/libuv/pull/525
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-22 11:18:13 -04:00
Bert Belder
1ad6ad7ada test: add tests for the uv_rwlock implementation
PR-URL: https://github.com/libuv/libuv/pull/525
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-22 11:17:49 -04:00
Jianghua Yang
9c307cc630 darwin: fix memory leak in uv_cpu_info
PR-URL: https://github.com/libuv/libuv/pull/538
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-22 12:11:45 +02:00
Saúl Ibarra Corretgé
bd1777fd53 unix, win: consolidate mutex trylock errors
Fold EAGAIN into EBUSY, and make it the only acceptable error.

PR-URL: https://github.com/libuv/libuv/pull/535
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-22 00:08:05 +02:00
Saúl Ibarra Corretgé
85adf43e03 unix: consolidate rwlock tryrdlock trywrlock errors
Fold EAGAIN and EBUSY into EBUSY. This makes it consistent across all
Unix platforms and Windows.

Refs: https://github.com/libuv/libuv/pull/525
PR-URL: https://github.com/libuv/libuv/pull/535
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-22 00:07:28 +02:00
nmushell
029a43997d unix: Fix including uv-aix.h on AIX
On AIX, it is correct to include AIX specific include files.
This is similar to all other platforms (ex. darwin, linux).

Signed-off-by: Neil Mushell <nmushell@bloomberg.net>

PR-URL: https://github.com/libuv/libuv/pull/521
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-11 18:02:14 +02:00
nmushell
cf0e5b4db2 unix: Support atomic compare & swap xlC on AIX
On AIX with the native xlC compiler, the compiler supports sync
compare swap and compare in two flavors:
 1 __compare_and_swap
 2 __compare_and_swaplp

This differs from the gcc version of this function in name. The
second version of this function supports 8-byte boundary for
a doubleword. Therefore, the macro logic checks:
 if (AIX OS AND using xlC compiler)
    if (64bit)
       __compare_and_swaplp /* 64 bit version */
    else
       __compare_and_swap
    endif
 endif

Signed-off-by: Neil Mushell <nmushell@bloomberg.net>

PR-URL: https://github.com/libuv/libuv/pull/521
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-11 18:00:33 +02:00
Saúl Ibarra Corretgé
e2db9240db Working on the next version 2015-09-11 17:58:25 +02:00
Saúl Ibarra Corretgé
05284402af Add SHA to ChangeLog 2015-09-11 17:44:07 +02:00
Saúl Ibarra Corretgé
a7ad4f5218 2015.09.12, Version 1.7.4 (Stable)
Changes since version 1.7.3:

* doc: uv_read_start and uv_read_cb clarifications (Ben Trask)

* freebsd: obtain true uptime through clock_gettime() (Jianghua Yang)

* win, tty: do not convert \r to \r\n (Colin Snover)

* build,gyp: add DragonFly to the list of OSes (Michael Neumann)

* fs: fix bug in sendfile for DragonFly (Michael Neumann)

* doc: add uv_dlsym() return type (Brian White)

* tests: fix fs tests run w/o full getdents support (Jeremy Whitlock)

* doc: fix typo (Devchandra Meetei Leishangthem)

* doc: fix uv-unix.h location (Sakthipriyan Vairamani)

* unix: fix error check when closing process pipe fd (Ben Noordhuis)

* test,freebsd: fix ipc_listen_xx_write tests (Santiago Gimeno)

* win: fix unsavory rwlock fallback implementation (Bert Belder)

* doc: clarify repeat timer behavior (Eli Skeggs)
2015-09-11 17:44:02 +02:00
Eli Skeggs
36b79057c5 doc: clarify repeat timer behavior
Signed-off-by: Eli Skeggs <skeggse@gmail.com>

Fixes: https://github.com/libuv/libuv/issues/181
PR-URL: https://github.com/libuv/libuv/pull/520
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-11 09:35:05 +02:00
Bert Belder
3eb6764acd win: fix unsavory rwlock fallback implementation
Before this patch an uv_mutex_t (backed by a critical section) could be
released by a tread different from the thread that acquired it, which is
not allowed. This is fixed by using a semaphore instead.

Note that the affected code paths were used on Windows XP and Windows
Server 2003 only.

Fixes: https://github.com/libuv/libuv/issues/515
PR-URL: https://github.com/libuv/libuv/pull/516
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-11 06:05:32 +02:00
Santiago Gimeno
57b0a6da42 test,freebsd: fix ipc_listen_xx_write tests
In FreeBSD if connect is called and the queue of pending connections(backlog)
is full, the call is automatically rejected with ECONNRESET. In the tests, 100
connections were tried and the backlog of both servers is 12, so the error.

To fix ipc_listen_before_write and ipc_listen_after_write, the backlog of the
server has been increased to 128.

PR-URL: https://github.com/libuv/libuv/pull/504
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-08 10:45:10 +02:00
Ben Noordhuis
e95960cc68 unix: fix error check when closing process pipe fd
uv__close() does not set errno, it returns the error.  It also never
returns EINTR, it always maps it to EINPROGRESS.

PR-URL: https://github.com/libuv/libuv/pull/512
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-07 13:33:27 +02:00
Sakthipriyan Vairamani
daa466275e doc: fix uv-unix.h location
uv-unix.h is in include directory, not in src.

PR-URL: https://github.com/libuv/libuv/pull/511
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-06 04:50:19 +02:00
Devchandra Meetei L
eddff0a675 doc: fix typo
PR-URL: https://github.com/libuv/libuv/pull/509
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-04 09:41:35 +02:00
Jeremy Whitlock
30fc362560 tests: fix fs tests run w/o full getdents support
fs_access, fs_async_dir and fs_symlink_dir could fail when the
filesystem where the tests are run does not fully support getting the
file type via getdents.  Having getdents support does not imply that the
underlying filesystem fully supports what is necessary for these tests
to have passed prior to this commit.  So the failing tests were updated
to check for UV_DIRENT_FILE as it did previously but it will also check for
UV_DIRENT_UNKNOWN as well to handle the filesystems that do not fully support
getting the file type via getdents.  For OS X and Windows, which are
known to fully support getting the file type, the tests work as they did
before and will not check for UV_DIRENT_UNKNOWN.  We could/should update the
preprocessor directive that chooses "rigorous" or "lax" checks
accordingly when we learn of new environments that should always do the
original "rigorous" checks.

Fixes: https://github.com/libuv/libuv/issues/501
PR-URL: https://github.com/libuv/libuv/pull/508
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-03 23:47:54 +02:00
Brian White
866dc3f98b doc: add uv_dlsym() return type
PR-URL: https://github.com/libuv/libuv/pull/503
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-02 09:58:55 +02:00
Michael Neumann
8b90faff6c fs: fix bug in sendfile for DragonFly
The code made an implicit assumption that the 'len` variable passed
to the sendfile(2) syscall is not modified by the operating system
in case of an error other than EAGAIN or EINTR.

The man page leaves this unspecified on FreeBSD, DragonFly and
Darwin, so better check the error code which returns a valid
value in `len` explicitly (only EAGAIN and EINTR).

This fixes the test case for sendfile on DragonFly.

PR-URL: https://github.com/libuv/libuv/pull/466
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-01 09:22:43 +02:00
Michael Neumann
d58e94408f build,gyp: add DragonFly to the list of OSes
PR-URL: https://github.com/libuv/libuv/pull/466
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-09-01 09:20:48 +02:00
Colin Snover
7cd0cd8a40 win, tty: do not convert \r to \r\n
\r is a single carriage return without line feed on all platforms,
including Windows.

PR-URL: https://github.com/libuv/libuv/pull/472
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-08-31 10:07:40 +02:00
Jianghua Yang
030b6e1a40 freebsd: obtain true uptime through clock_gettime()
Obtain true uptime through clock_gettime() instead of subtracting
'bootime' from 'now'.

PR-URL: https://github.com/libuv/libuv/pull/497
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-31 10:05:48 +02:00
Ben Trask
9ef523e281 doc: uv_read_start and uv_read_cb clarifications
PR-URL: https://github.com/libuv/libuv/pull/500
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-31 10:04:07 +02:00
Saúl Ibarra Corretgé
368f427c2f Add SHA to ChangeLog 2015-08-27 23:42:43 +02:00
Saúl Ibarra Corretgé
93877b11c8 2015.08.28, Version 1.7.3 (Stable)
Changes since version 1.7.2:

* threadpool: fix thread starvation bug (Ben Noordhuis)
2015-08-27 23:42:36 +02:00
Ben Noordhuis
da42780223 threadpool: fix thread starvation bug
Commit 0f1bdb6 ("threadpool: send signal only when queue is empty")
introduces a regression where work is not evenly distributed across
the thread pool because the work queue's condition variable is only
signalled when the queue is empty, even when there are waiting workers.

It doesn't turn into outright deadlock because there is always
at least one thread making forward progress but it does degrade
throughput, sometimes massively so.

Signalling whenever there are waiting workers fixes the throughput
issue while still keeping the number of uv_cond_signal() calls low,
which was the motivation for commit 0f1bdb6.

Fixes: https://github.com/libuv/libuv/pull/490
Fixes: https://github.com/libuv/libuv/issues/492
PR-URL: https://github.com/libuv/libuv/pull/493
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-26 19:53:09 +02:00
Saúl Ibarra Corretgé
137d6af70a Add SHA to ChangeLog 2015-08-24 23:26:31 +02:00
Saúl Ibarra Corretgé
4d13a013fc 2015.08.25, Version 1.7.2 (Stable)
Changes since version 1.7.1:

* unix, win: make uv_loop_init return on error (Willem Thiart)

* win: reset pipe handle for pipe servers (Saúl Ibarra Corretgé)

* win: fix replacing pipe handle for pipe servers (Saúl Ibarra Corretgé)

* win: fix setting pipe pending instances after bind (Saúl Ibarra
  Corretgé)
2015-08-24 23:26:27 +02:00
Saúl Ibarra Corretgé
4f4e956497 win: fix setting pipe pending instances after bind
It's an error to do so, so just ignore it. The test would cause an
invalid memory access if the fix is undone.

PR-URL: https://github.com/libuv/libuv/pull/488
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-24 23:20:35 +02:00
Saúl Ibarra Corretgé
34768a76f5 win: fix replacing pipe handle for pipe servers
On Windows we create multiple pipe handles (system handles) which are
attached to pending accept requests. Each of these will take turns in
replacing the reference in handle->handle, so make sure we allow for
that **only** for pipe servers.

PR-URL: https://github.com/libuv/libuv/pull/488
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-24 23:20:35 +02:00
Saúl Ibarra Corretgé
9152b1bda4 win: reset pipe handle for pipe servers
On pipe servers handle->handle takes turns between the different server
handles, so after closing all of them just reset the dandling reference.

PR-URL: https://github.com/libuv/libuv/pull/488
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-24 23:20:35 +02:00
Willem Thiart
2a51b61e46 unix, win: make uv_loop_init return on error
Makes uv_loop_init return an error code instead of aborting.

Currently uv_loop_init aborts if there are insufficient resources
available. As a user I want to be able to check the return code from
uv_loop_init and decide how I respond rather than having my process die.

PR-URL: https://github.com/libuv/libuv/pull/405
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-20 17:39:21 +02:00
Saúl Ibarra Corretgé
2bc0e0400c Add SHA to ChangeLog 2015-08-19 22:45:12 +02:00
Saúl Ibarra Corretgé
44f4b6bd82 2015.08.20, Version 1.7.1 (Stable)
Changes since version 1.7.0:

* doc: document the procedure for verifying releases (Saúl Ibarra
  Corretgé)

* doc: add note about Windows binaries to the README (Saúl Ibarra
  Corretgé)

* doc: use long GPG IDs in MAINTAINERS.md (Saúl Ibarra Corretgé)

* Revert "stream: squelch ECONNRESET error if already closed" (Saúl
  Ibarra Corretgé)

* doc: clarify uv_read_stop() is idempotent (Corbin Simpson)

* unix: OpenBSD's setsockopt needs an unsigned char for multicast
  (Zachary Hamm)

* test: Fix two memory leaks (Karl Skomski)

* unix,win: return EINVAL on nullptr args in uv_fs_{read,write} (Karl
  Skomski)

* win: set accepted TCP sockets as non-inheritable (Saúl Ibarra
  Corretgé)

* unix: remove superfluous parentheses in fs macros (Ben Noordhuis)

* unix: don't copy arguments for sync fs requests (Ben Noordhuis)

* test: plug small memory leak in unix test runner (Ben Noordhuis)

* unix,windows: allow NULL loop for sync fs requests (Ben Noordhuis)

* unix,windows: don't assert on unknown error code (Ben Noordhuis)

* stream: retry write on EPROTOTYPE on OSX (Brian White)

* common: fix use of snprintf on Windows (Saúl Ibarra Corretgé)

* tests: refactored fs watch_dir tests for stability (Jeremy Whitlock)
2015-08-19 22:45:07 +02:00
Jeremy Whitlock
83264701a7 tests: refactored fs watch_dir tests for stability
fs_event_watch_dir and fs_event_watch_dir_recursive could fail randomly
due to the way in which the tests were written.  Originally timers were
used to create, remove and recreate the test files but this could lead
to a race condition if the timeout used to delete the test files ran
before all file creation fs events were handled.  On top of that, the
file removal timer scheduled another timer to recreate the test files
and that timer's timeout could also lead to the same condition.

The refactoring removed timers for the removal/recreation of the test
files and instead the fs event callback was updated to have the
necessary logic to drive the test file removal.  We no longer recreate
the test files since it appears to be unnecessary.

Fixes: https://github.com/libuv/libuv/issues/30
PR-URL: https://github.com/libuv/libuv/pull/480
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-19 22:13:51 +02:00
Saúl Ibarra Corretgé
4c81d05112 common: fix use of snprintf on Windows
Refs: https://github.com/libuv/libuv/pull/467
PR-URL: https://github.com/libuv/libuv/pull/487
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-19 11:40:16 +02:00
Brian White
406961385d stream: retry write on EPROTOTYPE on OSX
At least on OS X 10.10 "Yosemite", an EPROTOTYPE can occur
when trying to write to a socket that is shutting down.
By retrying the write after EPROTOTYPE, we correctly get EPIPE.

PR-URL: https://github.com/libuv/libuv/pull/482
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-19 09:25:41 +02:00
Ben Noordhuis
96fc77d5d9 unix,windows: don't assert on unknown error code
Make uv_err_name() and uv_strerror() return a dynamically allocated
string when the error code is not recognized.

It leaks a few bytes of memory but that can't be helped.  Asserting
and aborting is, in my opinion, much less helpful.

Fixes: https://github.com/nodejs/node/issues/63
PR-URL: https://github.com/libuv/libuv/pull/467
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-18 16:10:37 +02:00
Ben Noordhuis
df62b54aa2 unix,windows: allow NULL loop for sync fs requests
Synchronous file operations don't need an event loop.  Permit NULL as
the event loop parameter.

Fixes: https://github.com/libuv/libuv/issues/469
PR-URL: https://github.com/libuv/libuv/pull/479
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-18 15:39:21 +02:00
Ben Noordhuis
54eecf32a9 test: plug small memory leak in unix test runner
Join the watchdog thread unconditionally on exit.  Fixes the following
harmless but noisy memory leak:

    576 bytes in 1 blocks are possibly lost in loss record 1 of 2
       at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x40121B4: _dl_allocate_tls (in /usr/lib64/ld-2.21.so)
       by 0x5AEA045: pthread_create@@GLIBC_2.2.5 (in /usr/lib64/libpthread-2.21.so)
       by 0x450D3E: process_wait (runner-unix.c:212)
       by 0x4067F1: run_test (runner.c:284)
       by 0x405EC3: maybe_run_test (run-tests.c:180)
       by 0x4058AD: main (run-tests.c:57)

PR-URL: https://github.com/libuv/libuv/pull/479
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-18 15:39:18 +02:00
Ben Noordhuis
e19764f75a unix: don't copy arguments for sync fs requests
For synchronous file operation requests (ones without a callback), there
is no need to make a copy of the arguments because they don't outlive
the scope of the function call.

PR-URL: https://github.com/libuv/libuv/pull/479
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-18 15:39:16 +02:00
Ben Noordhuis
3ed7fcee5b unix: remove superfluous parentheses in fs macros
The parentheses are unnecessary because what they wrap are not macro
arguments but function arguments that aren't evaluated by the macro.

PR-URL: https://github.com/libuv/libuv/pull/479
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-18 15:38:42 +02:00
Saúl Ibarra Corretgé
64f5c93fb1 win: set accepted TCP sockets as non-inheritable
This piece of code was incorrectly removed by yours truly in 2dddd56.
It triggered a rather obscure failure in Node:
https://github.com/nodejs/node/pull/2310

PR-URL: https://github.com/libuv/libuv/pull/483
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-18 15:14:50 +02:00
Karl Skomski
939ea06f45 unix,win: return EINVAL on nullptr args in uv_fs_{read,write}
PR-URL: https://github.com/libuv/libuv/pull/470
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-11 13:35:54 +02:00
Karl Skomski
c2e6f3bad1 test: Fix two memory leaks
PR-URL: https://github.com/libuv/libuv/pull/470
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-11 13:35:34 +02:00
Zachary Hamm
3869f2a8c0 unix: OpenBSD's setsockopt needs an unsigned char for multicast
PR-URL: https://github.com/libuv/libuv/pull/477
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-10 09:27:53 +02:00
Corbin Simpson
fc556acbb4 doc: clarify uv_read_stop() is idempotent
PR-URL: https://github.com/libuv/libuv/pull/478
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-10 09:20:51 +02:00
Saúl Ibarra Corretgé
01544d861b Revert "stream: squelch ECONNRESET error if already closed"
This reverts commit 05a003a3f7.

This commit triggerd "test-tls-hello-parser-failure" failure in io.js.
See the reference below for a more thorough explanation.

Refs: https://github.com/nodejs/io.js/pull/2310
PR-URL: https://github.com/libuv/libuv/pull/475
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-08-07 14:19:08 +02:00