Commit Graph

4148 Commits

Author SHA1 Message Date
Ali Ijaz Sheikh
3af6f17241 test: add uv_barrier_wait serial thread test
Ensure that uv_barrier_wait returns positive only after all threads have
exited the barrier. If this value is returned too early and the barrier
is destroyed prematurely, then this test may see a crash.

PR-URL: https://github.com/libuv/libuv/pull/2019
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-08 11:14:41 +02:00
Ben Noordhuis
49b8a9f181 unix: signal done to last thread barrier waiter
Libuv's own thread barrier implementation signaled completion to the
first waiter that saw the threshold being reached, contrary to what
some native pthreads barrier implementations do, which is to signal
it to the _last_ waiter.

Libuv's behavior is not strictly non-conforming but it's inconvenient
because it means this snippet (that appears in the libuv documentation)
has a race condition in it:

    if (uv_barrier_wait(&barrier) > 0)
      uv_barrier_destroy(&barrier);  // can still have waiters

This issue was discovered and fixed by Ali Ijaz Sheikh, a.k.a @ofrobots,
but some refactoring introduced conflicts in his pull request and I
didn't have the heart to ask him to redo it from scratch. :-)

PR-URL: https://github.com/libuv/libuv/pull/2019
Refs: https://github.com/libuv/libuv/pull/2003
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-08 11:14:41 +02:00
Ben Noordhuis
a3a601c5da aix: switch to libuv's own thread barrier impl
It was pointed out that pthread_barrier_wait() behaves slightly
different from other platforms. Switch to libuv's own thread barrier
for uniformity of behavior. Perhaps we'll do that for more platforms
in the future.

PR-URL: https://github.com/libuv/libuv/pull/2019
Refs: https://github.com/libuv/libuv/pull/2003#issuecomment-426471646
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-08 11:14:41 +02:00
Ben Noordhuis
56702e08bf unix: rework thread barrier implementation
* dissolve include/uv/pthread-barrier.h

* use libuv mutexes and condition variables, not pthreads's

* drive-by cleanup and simplification enabled by the first two items

PR-URL: https://github.com/libuv/libuv/pull/2019
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-08 11:14:41 +02:00
Anna Henningsen
daf04e83cb
unix,win: fix threadpool race condition
90891b4232 introduced a race
condition when accessing `slow_io_work_running` – it is being
increased and later decreased as part of the worker thread loop,
but was accessed with different mutexes during these operations.

This fixes the race condition by making sure both accesses
are protected through the global `mutex` of `threadpool.c`.

This fixes a number of flaky Node.js tests.

Refs: https://github.com/libuv/libuv/pull/1845
Refs: https://github.com/nodejs/reliability/issues/18
Refs: https://github.com/nodejs/node/issues/23089
Refs: https://github.com/nodejs/node/issues/23067
Refs: https://github.com/nodejs/node/issues/23066
Refs: https://github.com/nodejs/node/issues/23219
PR-URL: https://github.com/libuv/libuv/pull/2021
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-10-07 15:50:57 -07:00
Ben Noordhuis
6781db5c78 doc: remove extraneous "on"
Fixes: https://github.com/libuv/libuv/issues/2000
PR-URL: https://github.com/libuv/libuv/pull/2010
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jamie Davis <davisjam@vt.edu>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-02 12:58:39 +02:00
Bartosz Sosnowski
ee87f34474
win,tty: fix uv_tty_close()
Under some condition, uv_tty_close() would not stop console reads.
This fixes that issue by first stopping read, then closing the
handle.

Fixes: https://github.com/nodejs/node/issues/22999
PR-URL: https://github.com/libuv/libuv/pull/2005
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-09-30 13:02:11 -04:00
Jameson Nash
60abdbaed6 unix,readv: always permit partial reads to return
For simplicity and predictability (since the user must handle the retry
anyways), always emit exactly one readv/pread/preadv syscall and return
that result to the user.

By contrast, write needs to preserve order, so it needs to keep retrying
the operation until it finishes before retiring the req from the queue.

Fixes: https://github.com/nodejs/node/issues/16601
PR-URL: https://github.com/libuv/libuv/pull/1742
Refs: https://github.com/libuv/libuv/pull/640
Refs: https://github.com/libuv/libuv/issues/1720
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-28 21:47:07 +02:00
Jameson Nash
19a3419195 Revert "Revert "unix,fs: fix for potential partial reads/writes""
This reverts commit b0f3310bb1.
(but not the test deletion)

Fixes: https://github.com/nodejs/node/issues/16601
PR-URL: https://github.com/libuv/libuv/pull/1742
Refs: https://github.com/libuv/libuv/pull/640
Refs: https://github.com/libuv/libuv/issues/1720
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-28 21:46:47 +02:00
Bartosz Sosnowski
b9a0840307
tty, win: fix read stop for raw mode
New Windows version requires `EventType` to be set to something
meaningful, otherwise WriteConsoleInputW() will fail with
`ERROR_INVALID_PARAMETER`. This sets it to `FOCUS_EVENT` which
is ignored by `uv_process_tty_read_raw_req()`.

Fixes: https://github.com/nodejs/node/issues/21773
PR-URL: https://github.com/libuv/libuv/pull/1989
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2018-09-26 13:46:25 -04:00
cjihrig
4bd01873eb
test: handle uv_os_setpriority() windows edge case
Refs: https://github.com/nodejs/node/pull/22817
Refs: https://github.com/libuv/help/issues/64
PR-URL: https://github.com/libuv/libuv/pull/2002
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-09-25 20:56:37 -04:00
cjihrig
3dc0f53965
unix: initialize uv_interface_address_t.phys_addr
This commit ensures that the memory of the phys_addr field is
initialized on all platforms.

Fixes: https://github.com/nodejs/node/issues/23043
PR-URL: https://github.com/libuv/libuv/pull/1999
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-09-25 09:40:22 -04:00
cjihrig
95b5df7ae9
unix: return 0 retrieving rss on cygwin
Refs: https://github.com/libuv/libuv/pull/1939
PR-URL: https://github.com/libuv/libuv/pull/1992
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-21 10:51:38 -04:00
cjihrig
deb2226909
Now working on version 1.23.2
Fixes: https://github.com/libuv/libuv/issues/1993
2018-09-21 10:10:01 -04:00
cjihrig
56b028bb79
Add SHA to ChangeLog 2018-09-21 10:08:30 -04:00
cjihrig
d2282b3d67
2018.09.22, Version 1.23.1 (Stable)
Changes since version 1.23.0:

* unix,win: limit concurrent DNS calls to nthreads/2 (Anna Henningsen)

* doc: add addaleax to maintainers (Anna Henningsen)

* doc: add missing slash in stream.rst (Emil Bay)

* unix,fs: use utimes & friends for uv_fs_utime (Jeremiah Senkpiel)

* unix,fs: remove linux fallback from utimesat() (Jeremiah Senkpiel)

* unix,fs: remove uv__utimesat() syscall fallback (Jeremiah Senkpiel)

* doc: fix argument name in tcp.rts (Emil Bay)

* doc: notes on running tests, benchmarks, tools (Jamie Davis)

* linux: remove epoll syscall wrappers (Ben Noordhuis)

* linux: drop code path for epoll_pwait-less kernels (Ben Noordhuis)

* Partially revert "win,code: remove GetQueuedCompletionStatus-based
  poller" (Jameson Nash)

* build: add compile for android arm64/x86/x86-64 (Andy Zhang)

* doc: clarify that some remarks apply to windows (Bert Belder)

* test: fix compiler warnings (Jamie Davis)

* ibmi: return 0 from uv_resident_set_memory() (dmabupt)

* win: fix uv_udp_recv_start() error translation (Ryan Liptak)

* win,doc: improve uv_os_setpriority() documentation (Bartosz Sosnowski)

* test: increase upper bound in condvar_5 (Jamie Davis)

* win,tty: remove deadcode (Jameson Nash)

* stream: autodetect direction (Jameson Nash)
2018-09-21 10:08:29 -04:00
Jameson Nash
40498795ab stream: autodetect direction
Previously, we required the user to specify the expected read/write
flags for a pipe or tty. But we've already been asking the OS to tell us
what they actually are (fcntl F_GETFL), so we can hopefully just use
that information directly.

Fixes: https://github.com/libuv/libuv/issues/1936
PR-URL: https://github.com/libuv/libuv/pull/1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-19 18:19:28 +02:00
Jameson Nash
956bf6b71a win,tty: remove deadcode
Not used anywhere or exported. Most of this code also cares which
direction handle is open too (Input or Output), so it's not particularly
useful.

PR-URL: https://github.com/libuv/libuv/pull/1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-19 18:19:28 +02:00
Jamie Davis
bb1a49e9f2
test: increase upper bound in condvar_5
Problem:
Upper bound on thread wakeup was set to 1.5 * (requested timeout).
On MacOS wakeup delay factors of 1.75 have been reported.

Solution:
Increase the bound to 5 * (requested timeout).

Refs: https://github.com/libuv/libuv/issues/1910
PR-URL: https://github.com/libuv/libuv/pull/1990
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-19 09:27:24 -04:00
Bartosz Sosnowski
b721891ad4
win,doc: improve uv_os_setpriority() documentation
Refs: https://github.com/nodejs/node/pull/22817
PR-URL: https://github.com/libuv/libuv/pull/1985
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-18 12:13:01 -04:00
Ryan Liptak
57b3363e23
win: fix uv_udp_recv_start() error translation
PR-URL: https://github.com/libuv/libuv/pull/1979
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-09-18 12:02:40 -04:00
dmabupt
8813dca388
ibmi: return 0 from uv_resident_set_memory()
PR-URL: https://github.com/libuv/libuv/pull/1939
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-09-18 11:54:27 -04:00
Jamie Davis
abe9e01cfb
test: fix compiler warnings
Problem:
libuv is compiled with -Wunused-result.
In two tests, read() is used for ordering and the
rc is ignored because it doesn't matter.
But -Wunused-result causes warnings in these cases.

Fix:
Provide a (very generous) check on the rc of read()
in these cases.

PR-URL: https://github.com/libuv/libuv/pull/1956
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-09-18 11:49:58 -04:00
Bert Belder
baa621c85e
doc: clarify that some remarks apply to windows
PR-URL: https://github.com/libuv/libuv/pull/1988
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-09-18 10:05:06 -04:00
Andy Zhang
baa81465ad build: add compile for android arm64/x86/x86-64
Add compile options for Android arm64/x86/x86-64 and update the
instructions in README.md.

PR-URL: https://github.com/libuv/libuv/pull/1934
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-09-17 12:47:13 +02:00
Jameson Nash
153ea114ff
Partially revert "win,code: remove GetQueuedCompletionStatus-based poller"
This reverts commit fd8d212a80,
and thereby restores partial support for using libuv under Wine
(which does not implement GetQueuedCompletionStatusEx).

PR-URL: https://github.com/libuv/libuv/pull/1963
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2018-09-10 07:59:00 +02:00
Ben Noordhuis
f43c663433 linux: drop code path for epoll_pwait-less kernels
Remove the support for kernels that don't support epoll_pwait()
now that the minimum requirements are kernel 2.6.32 + glibc 2.12.

PR-URL: https://github.com/libuv/libuv/pull/1372
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-06 13:07:42 +02:00
Ben Noordhuis
9208df0c93 linux: remove epoll syscall wrappers
Remove the syscalls wrappers now that the minimum requirements are
kernel 2.6.32 + glibc 2.12.

This commit should fix the epoll_pwait()-related issues that have
been reported against mips/mipsel builds.

Fixes: https://github.com/libuv/libuv/issues/335
PR-URL: https://github.com/libuv/libuv/pull/1372
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-06 13:07:13 +02:00
Jamie Davis
c0c672e1a0
doc: notes on running tests, benchmarks, tools
PR-URL: https://github.com/libuv/libuv/pull/1971
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-03 14:55:10 +02:00
Emil Bay
89a9ea672b
doc: fix argument name in tcp.rts
PR-URL: https://github.com/libuv/libuv/pull/1974
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-09-03 14:46:35 +02:00
Jeremiah Senkpiel
fa5c1d9296
unix,fs: remove uv__utimesat() syscall fallback
This is now unnecessary as of the previous commit.

PR-URL: https://github.com/libuv/libuv/pull/1940
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-09-03 14:34:07 +02:00
Jeremiah Senkpiel
a519c8b206
unix,fs: remove linux fallback from utimesat()
Previously both uv_fs_utimes and uv_fs_futimes would fall back to utimes() if untimesat() wasn't supported.

Since utimesat() has been supported since linux kernel 2.6.22, and libuv supports at minimum 2.6.32, this code can be removed.

PR-URL: https://github.com/libuv/libuv/pull/1940
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-09-03 14:33:56 +02:00
Jeremiah Senkpiel
3646624e5e
unix,fs: use utimes & friends for uv_fs_utime
This should improve uv_fs_utime resolution and reliability, as
utime(2)'s precision is left more to the implementing platform than the
newer but well supported alternatives.

Related to https://github.com/nodejs/node/issues/22070
PR-URL: https://github.com/libuv/libuv/pull/1940
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-09-03 14:33:51 +02:00
Emil Bay
ff45b0d789
doc: add missing slash in stream.rst
PR-URL: https://github.com/libuv/libuv/pull/1973
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2018-09-01 13:01:10 +02:00
Anna Henningsen
1391a3d9d0
doc: add addaleax to maintainers
PR-URL: https://github.com/libuv/libuv/pull/1961
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2018-08-28 21:08:49 +02:00
Anna Henningsen
90891b4232
unix,win: limit concurrent DNS calls to nthreads/2
If `nthreads / 2` (rounded up) DNS calls are outstanding,
queue more work of that kind instead of letting it take over
more positions in the thread pool, blocking other work
such as the (usually much faster) file system I/O or
user-scheduled work.

Fixes: https://github.com/nodejs/node/issues/8436
PR-URL: https://github.com/libuv/libuv/pull/1845
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-08-21 10:48:24 +02:00
cjihrig
69c43d987b
Now working on version 1.23.1
Fixes: https://github.com/libuv/libuv/issues/1942
2018-08-16 22:07:33 -04:00
cjihrig
489ce32a7b
Add SHA to ChangeLog 2018-08-16 22:05:35 -04:00
cjihrig
7ebb26225f
2018.08.18, Version 1.23.0 (Stable)
Changes since version 1.22.0:

* win,pipe: restore compatibility with the old IPC framing protocol
  (Bert Belder)

* fs: add uv_open_osfhandle (Bartosz Sosnowski)

* doc: update Visual C++ Build Tools URL (Michał Kozakiewicz)

* unix: loop starvation on successful write complete (jBarz)

* win: add uv__getnameinfo_work() error handling (A. Hauptmann)

* win: return UV_ENOMEM from uv_loop_init() (cjihrig)

* unix,win: add uv_os_{get,set}priority() (cjihrig)

* test: fix warning in test-tcp-open (Santiago Gimeno)
2018-08-16 22:05:34 -04:00
Santiago Gimeno
589736303f
test: fix warning in test-tcp-open
PR-URL: https://github.com/libuv/libuv/pull/1946
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-08-16 10:28:49 +02:00
cjihrig
e57e07172e
unix,win: add uv_os_{get,set}priority()
Refs: https://github.com/nodejs/node/pull/21675
PR-URL: https://github.com/libuv/libuv/pull/1945
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-08-15 09:17:55 -04:00
cjihrig
7284adfa7a
win: return UV_ENOMEM from uv_loop_init()
This commit sets the error returned by uv_loop_init() to
UV_ENOMEM in the case of a failed timer heap malloc.

PR-URL: https://github.com/libuv/libuv/pull/1944
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-08-14 09:56:50 -04:00
Andreas Hauptmann
76b873e837
win: add uv__getnameinfo_work() error handling
This commit adds error handling to the two WideCharToMultiByte()
calls in uv__getnameinfo_work() on Windows.

PR-URL: https://github.com/libuv/libuv/pull/1907
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-08-11 19:32:07 -04:00
John Barboza
27e7a8b107
unix: loop starvation on successful write complete
A file descriptor that can do multiple successful write completion
requests in a row will starve the loop because it will keep feeding
the write_completed_queue. This fix will only process items on the
write_completed_queue once per event loop (in uv__run_pending).
Any new items on the queue will be processed in the next loop.

PR-URL: https://github.com/libuv/libuv/pull/1787
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-08-11 18:24:38 -04:00
Michał Kozakiewicz
43138eefae
doc: update Visual C++ Build Tools URL
Fixes: https://github.com/libuv/libuv/issues/1918
PR-URL: https://github.com/libuv/libuv/pull/1919
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-08-11 13:26:54 -04:00
Bartosz Sosnowski
8f96a5b07b fs: add uv_open_osfhandle
Adds uv_open_osfhandle to complete uv_get_osfhandle

Ref: https://github.com/nodejs/node/issues/15433
Ref: https://github.com/nodejs/node-addon-api/issues/304
PR-URL: https://github.com/libuv/libuv/pull/1927
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-08-09 11:19:15 +02:00
Bert Belder
27ba662811
win,pipe: restore compatibility with the old IPC framing protocol
Fixes: https://github.com/libuv/libuv/issues/1922
Refs: https://github.com/nodejs/node/issues/21671
PR-URL: https://github.com/libuv/libuv/pull/1923
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-07-22 01:52:30 +02:00
cjihrig
31a06f25e1
Now working on version 1.22.1
Fixes: https://github.com/libuv/libuv/issues/1914
2018-07-09 22:07:40 -04:00
cjihrig
7bc3d5150b
Add SHA to ChangeLog 2018-07-09 22:04:48 -04:00
cjihrig
8568f78a77
2018.07.11, Version 1.22.0 (Stable)
Changes since version 1.21.0:

* unix: remove checksparse.sh (Ben Noordhuis)

* win: fix mingw build error (Ben Noordhuis)

* win: fix -Wunused-function warnings in thread.c (Ben Noordhuis)

* unix,win: merge timers implementation (Ben Noordhuis)

* win: fix pointer type in pipe.c (Ben Noordhuis)

* win: fixing build for older MSVC compilers (Michael Fero)

* zos: clear poll events on every iteration (jBarz)

* zos: write-protect message queue (jBarz)

* zos: use correct pointer type in strnlen (jBarz)

* unix,win: merge handle flags (Ben Noordhuis)

* doc: update Imran Iqbal's GitHub handle (cjihrig)

* src: add new error apis to prevent memory leaks (Shelley Vohr)

* test: make test-condvar call uv_cond_wait (Jamie Davis)

* fs: change position of uv_fs_lchown (Ujjwal Sharma)
2018-07-09 22:04:47 -04:00