Commit Graph

4148 Commits

Author SHA1 Message Date
Ujjwal Sharma
4f43a8673b
fs: change position of uv_fs_lchown
Change the position of UV_LS_LCHOWN, moving it to the end in order to go
around a bug due to it's initial position.

The original position of UV_LS_LCHOWN broke ABI compat, causing a binary
using UV_FS_REALPATH or UV_FS_COPYFILE to break, as the values point to
wrong function.

Refs: https://github.com/yarnpkg/yarn/issues/6043
Fixes: https://github.com/libuv/libuv/issues/1908
PR-URL: https://github.com/libuv/libuv/pull/1913
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-07-07 15:48:44 +02:00
Jamie Davis
f401e67b60
test: make test-condvar call uv_cond_wait
Problem:
The condvar tests could pass without uv_cond_wait
(or uv_cond_timedwait) ever being invoked.

Solution:
Introduce semaphores to enforce ordering.
Now there will always be a thread waiting on the condition
when a signal() occurs.

Gotchas:
1. On Windows, waiting for a timeout may return earlier
than requested, depending on the granularity of timer ticks.
2. Timeout bounds are tuned based on our CI machines.

Bonuses:
1. I added additional test cases to complete the test matrix.

2. It seemed to me that several of the condvar tests were redundant,
because they used timing to probabilistically explore cases where there
would be "missed connections" (signal without a waiter).
Because it was not clear to me what the purpose of such tests were,
I have removed them.

Fixes: https://github.com/libuv/libuv/issues/1714
PR-URL: https://github.com/libuv/libuv/pull/1718
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-07-06 23:02:46 +02:00
Shelley Vohr
5124b27d35
src: add new error apis to prevent memory leaks
This PR creates two new externally-facing APIs, uv_err_name_r() and
uv_strerror_r().

In keeping with the precedent set by POSIX, the *_r() suffix of these
two new methods indicate that the caller does the memory management and
passes in the memory that the output will be stored in, which provides
an alternative for the two existent methods (uv_err_name() and
uv_strerror()), which, when called with an unknown error code, leak a
few bytes of memory.

PR-URL: https://github.com/libuv/libuv/pull/1898
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno santiago.gimeno@gmail.com
2018-07-06 19:35:21 +02:00
cjihrig
b16d10a017
doc: update Imran Iqbal's GitHub handle
PR-URL: https://github.com/libuv/libuv/pull/1905
Reviewed-By: Imran Iqbal <imran@imraniqbal.org>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2018-07-05 10:12:43 -04:00
Ben Noordhuis
619937c783 unix,win: merge handle flags
Some long overdue refactoring that unifies more of the UNIX and Windows
backends.

PR-URL: https://github.com/libuv/libuv/pull/1904
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2018-06-29 22:24:52 +02:00
John Barboza
71bb0cc25a zos: use correct pointer type in strnlen
PR-URL: https://github.com/libuv/libuv/pull/1868
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-29 04:38:28 -07:00
John Barboza
07039d74b1 zos: write-protect message queue
PR-URL: https://github.com/libuv/libuv/pull/1868
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-29 04:38:28 -07:00
John Barboza
844fb92b05 zos: clear poll events on every iteration
This is required because `poll` will not reset the flags which it isn't
polling itself.

PR-URL: https://github.com/libuv/libuv/pull/1868
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-29 04:38:28 -07:00
Michael Fero
1d878b01f7
win: fixing build for older MSVC compilers
Fixes: https://github.com/libuv/libuv/issues/1900
PR-URL: https://github.com/libuv/libuv/pull/1885
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2018-06-29 10:35:18 +02:00
Ben Noordhuis
e4087dedf8 win: fix pointer type in pipe.c
PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-25 23:49:43 +02:00
Ben Noordhuis
95c5bf8db1 unix,win: merge timers implementation
Merge src/unix/timer.c and src/win/timer.c into src/timer.c.  This
changes the Windows implementation from a binary tree to a binary
heap for generally better performance.

PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-25 23:48:15 +02:00
Ben Noordhuis
e1f505f84d win: fix -Wunused-function warnings in thread.c
PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-25 23:49:40 +02:00
Ben Noordhuis
36cdc13412 win: fix mingw build error
`UV__UNUSED()` does not evaluate to nothing with MinGW, use something
else instead to squelch the unused argument warning.

PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-25 23:48:59 +02:00
Ben Noordhuis
a7a16219d9 unix: remove checksparse.sh
I haven't it this much since its introduction in 2013.  All commits
since then have been maintenance updates (adding or removing files)
so let's just remove it.

PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-25 23:48:15 +02:00
cjihrig
07955ed373
Now working on version 1.21.1
Fixes: https://github.com/libuv/libuv/issues/1897
2018-06-22 11:07:12 -04:00
cjihrig
a562af962b
Add SHA to ChangeLog 2018-06-22 11:06:54 -04:00
cjihrig
e4983a9b0c
2018.06.23, Version 1.21.0 (Stable)
Changes since version 1.20.3:

* unix,windows: map EFTYPE errno (cjihrig)

* win: perform case insensitive PATH= comparison (cjihrig)

* win, fs: uv_fs_fchmod support for -A files (Bartosz Sosnowski)

* src,lib: fix comments (Tobias Nießen)

* win,process: allow child pipe handles to be opened in overlapped mode
  (Björn Linse)

* src,test: fix idiosyncratic comment style (Bert Belder)

* test: fs_fchmod_archive_readonly must return a value (Bert Belder)

* win,pipe: fix incorrect error code returned from uv_pipe_write_impl()
  (Bert Belder)

* win,pipe: properly set uv_write_t.send_handle in uv_write2() (Bert
  Belder)

* test: add vectored uv_write() ping-pong tests (Bert Belder)

* win,pipe: support vectored uv_write() calls (Bert Belder)

* win,pipe: refactor pipe read cancellation logic (Bert Belder)

* test: improve output from IPC test helpers (Bert Belder)

* test: add test for IPC deadlock on Windows (

* win,pipe: fix IPC pipe deadlock (Bert Belder)

* unix: catch some cases of watching fd twice (Ben Noordhuis)

* test: use custom timeout for getaddrinfo_fail_sync (Ben Noordhuis)

* Revert "win: add Windows XP support to uv_if_indextoname()" (Bert
  Belder)

* win,thread: remove fallback uv_cond implementation (Bert Belder)

* src,test: s/olny/only (cjihrig)

* unix: close signal pipe fds on unload (Ben Noordhuis)

* win: allow setting udp socket options before bind (cjihrig)

* unix: return UV_ENOTSUP on FICLONE_FORCE failure (cjihrig)

* win,pipe: remove unreferenced local variable (Bert Belder)

* win,code: remove GetQueuedCompletionStatus-based poller (Bert Belder)

* win: remove the remaining dynamic kernel32 imports (Bert Belder)

* test: speedup process-title-threadsafe on macOS (cjihrig)

* core: move all include files except uv.h to uv/ (Saúl Ibarra Corretgé)

* win: move stdint-msvc2008.h to include/uv/ (Ben Noordhuis)

* build: fix cygwin install (Ben Noordhuis)

* build,win: remove MinGW Makefile (Saúl Ibarra Corretgé)

* build: add a cmake build file (Ben Noordhuis)

* build: add test suite option to cmake build (Ben Noordhuis)

* unix: set errno in uv_fs_copyfile() (cjihrig)

* samples: fix inconsistency in parse_opts vs usage (zyxwvu Shi)

* linux: handle exclusive POLLHUP with UV_DISCONNECT (Brad King)

* include: declare uv_cpu_times_s in higher scope (Peter Johnson)

* doc: add uv_fs_fsync() AIX limitations (jBarz)

* unix,win: add uv_fs_lchown() (Paolo Greppi)

* unix: disable clang variable length array warning (Peter Johnson)

* doc: document uv_pipe_t::ipc (Ed Schouten)

* doc: undocument uv_req_type's UV_REQ_TYPE_PRIVATE (Ed Schouten)

* doc: document UV_*_MAP() macros (Ed Schouten)

* win: remove use of min() macro in pipe.c (Peter Johnson)

* doc: add jbarz as maintainer (
2018-06-22 11:04:58 -04:00
John Barboza
6cde153f9b doc: add jbarz as maintainer (#1876)
PR-URL: #1876
Reviewed-By: Colin Ihrig cjihrig@gmail.com
Reviewed-By: Santiago Gimeno santiago.gimeno@gmail.com
Reviewed-By: Saúl Ibarra Corretgé saghul@gmail.com
Reviewed-By: Ben Noordhuis info@bnoordhuis.nl
2018-06-20 11:50:18 -07:00
Peter Johnson
4e2fec16b7
win: remove use of min() macro in pipe.c
This macro is not guaranteed to be present in stdlib.h and the
macro may be disabled on Windows in some situations (e.g. when
NOMINMAX is defined).

PR-URL: https://github.com/libuv/libuv/pull/1891
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-06-20 08:48:41 -04:00
Ed Schouten
0802c81966
doc: document UV_*_MAP() macros
UV_ERRNO_MAP(), UV_HANDLE_TYPE_MAP(), and UV_REQ_TYPE_MAP() are
considered part of the public API. This commit documents them.

Fixes: https://github.com/libuv/libuv/issues/1607
PR-URL: https://github.com/libuv/libuv/pull/1653
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 22:58:50 -04:00
Ed Schouten
46464dd1b7
doc: undocument uv_req_type's UV_REQ_TYPE_PRIVATE
This is merely an internal definition that may expand to OS
specific request types. It is not an actual symbolic constant
part of the enumeration.

Fixes: https://github.com/libuv/libuv/issues/1607
PR-URL: https://github.com/libuv/libuv/pull/1653
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 22:57:08 -04:00
Ed Schouten
295311dca1
doc: document uv_pipe_t::ipc
Fixes: https://github.com/libuv/libuv/issues/1607
PR-URL: https://github.com/libuv/libuv/pull/1653
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 22:53:10 -04:00
Peter Johnson
ec69500bdd
unix: disable clang variable length array warning
PR-URL: https://github.com/libuv/libuv/pull/1892
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 22:43:39 -04:00
Paolo Greppi
aa28f7d5bf
unix,win: add uv_fs_lchown()
Fixes: https://github.com/libuv/libuv/issues/1790
PR-URL: https://github.com/libuv/libuv/pull/1826
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 10:05:01 -04:00
John Barboza
8ab14e2cb9
doc: add uv_fs_fsync() AIX limitations
Unlike other platforms, the fsync call on aix will not accept
non-regular file file-descriptors.

Refs: https://github.com/nodejs/node/pull/21298
PR-URL: https://github.com/libuv/libuv/pull/1879
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-06-19 09:35:45 -04:00
Peter Johnson
02fc10918c
include: declare uv_cpu_times_s in higher scope
This fixes a C/C++ ambiguity about whether this structure is
scoped or global.

PR-URL: https://github.com/libuv/libuv/pull/1888
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 09:29:33 -04:00
Brad King
06cb00c84f
linux: handle exclusive POLLHUP with UV_DISCONNECT
In commit c7c8e916b8 (poll: add UV_DISCONNECT event, 2016-01-11) we
forgot to update the workaround added by commit 24bfef2ef4 (linux:
handle EPOLLHUP without EPOLLIN/EPOLLOUT, 2013-11-08).  On
linux-sparc64, epoll returns just POLLHUP during part of our
`poll_duplex` and `poll_unidirectional` tests, triggering the need for
the workaround to recognize UV_DISCONNECT.

Fixes: https://github.com/libuv/libuv/issues/1859
PR-URL: https://github.com/libuv/libuv/pull/1896
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-19 09:00:00 -04:00
zyxwvu Shi
52cce6a4c0 samples: fix inconsistency in parse_opts vs usage
PR-URL: https://github.com/libuv/libuv/pull/1883
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-06-15 20:06:06 +02:00
cjihrig
e179bd1b43
unix: set errno in uv_fs_copyfile()
When the specific value of -1 is returned, uv__fs_work() uses
the value of errno. This commit sets errno in uv__fs_copyfile().

Fixes: https://github.com/nodejs/node/issues/21329
PR-URL: https://github.com/libuv/libuv/pull/1881
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-06-14 12:50:50 -04:00
Ben Noordhuis
1a0f619530 build: add test suite option to cmake build
PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:42:51 +02:00
Ben Noordhuis
7e6681f733 build: add a cmake build file
All good things come in threes and that's why besides autotools and gyp,
you can now also build everyone's favorite platform abstraction library
with cmake.

This is Ouroboros eating its own tail in a way because cmake depends on
libuv, depends on cmake, depends on libuv, depends on... inception!

Things it does:

* build the shared library
* build the static library
* install the shared library
* install the static library
* install the header files
* install libuv.pc

Things it does not yet do:

* build or install the documentation
* build or execute the test suite
* produce a release tarball
* provide auto-config for downstream cmake-based projects

Fixes: https://github.com/libuv/libuv/issues/1362
PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:40:16 +02:00
Saúl Ibarra Corretgé
3045fe1242 build,win: remove MinGW Makefile
MSYS2 + MinGW-w64 have good support for autoconf, that should be the
preferred way of building libuv under MinGW.

This is a cherry-pick of commit ee949df1cb from the master branch.

PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:40:13 +02:00
Ben Noordhuis
454ab3e137 build: fix cygwin install
Use the right file path and variable name for the posix.h header file.

Introduced when commit ce41af28 ("cygwin: include uv-posix.h header")
was merged from the v1.x branch, where it is the correct path, into
the master branch.

This is a cherry-pick of commit d0c2ad39 from the master branch.

PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:40:11 +02:00
Ben Noordhuis
47dcc07cf7 win: move stdint-msvc2008.h to include/uv/
Move it so that include/ contains uv.h and nothing more.

PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:40:09 +02:00
Saúl Ibarra Corretgé
99ae3edf28 core: move all include files except uv.h to uv/
This is a cherry-pick of commit d010030ad5 from the master branch.

Conflicts:
 	Makefile.am
 	include/uv.h
 	include/uv/unix.h
 	libuv.nsi (deleted)
 	src/unix/pthread-barrier.c (deleted)

PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-14 18:39:32 +02:00
cjihrig
0cdb4a5b4b
test: speedup process-title-threadsafe on macOS
This test has been timing out on macOS. Try to avoid that by
reducing the number of iterations run.

PR-URL: https://github.com/libuv/libuv/pull/1867
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2018-06-05 11:30:28 -04:00
Bert Belder
a7493d8a1d
win: remove the remaining dynamic kernel32 imports
They were only there to aid Windows XP support, which libuv no longer
does.

PR-URL: https://github.com/libuv/libuv/pull/1858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-06-05 00:45:48 -07:00
Bert Belder
fd8d212a80
win,code: remove GetQueuedCompletionStatus-based poller
All Windows versions that libuv supports have GetQueuedCompletionStatusEx,
so this fallback option is no longer needed.

PR-URL: https://github.com/libuv/libuv/pull/1858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-06-05 00:45:41 -07:00
Bert Belder
bada995129
win,pipe: remove unreferenced local variable
PR-URL: https://github.com/libuv/libuv/pull/1858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2018-06-05 00:45:35 -07:00
cjihrig
6103d294f7
unix: return UV_ENOTSUP on FICLONE_FORCE failure
Instead of returning whatever error is provided by the
underlying platform, use UV_ENOTSUP.

Fixes: https://github.com/libuv/libuv/issues/1862
PR-URL: https://github.com/libuv/libuv/pull/1863
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-06-04 09:19:06 -04:00
cjihrig
0c28363059
win: allow setting udp socket options before bind
Unix allows socket options to be set prior to binding. This
commit aligns Windows with this behavior.

Refs: https://github.com/joyent/libuv/issues/1205
Refs: https://github.com/joyent/libuv/pull/1270
Fixes: https://github.com/libuv/libuv/issues/1842
PR-URL: https://github.com/libuv/libuv/pull/1861
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-06-04 09:19:06 -04:00
Ben Noordhuis
a4623c7392 unix: close signal pipe fds on unload
Add a destructor function that closes the file descriptors when libuv.so
is unloaded.

Fixes: https://github.com/libuv/help/issues/52
PR-URL: https://github.com/libuv/libuv/pull/1857
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-06-02 18:13:48 +02:00
cjihrig
06fdc2bd0e
src,test: s/olny/only
PR-URL: https://github.com/libuv/libuv/pull/1848
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-05-30 13:29:15 -07:00
Bert Belder
13e8b15eb7
win,thread: remove fallback uv_cond implementation
The fallback implementation existed to support Windows XP and Server 2003,
but these old versions of windows are no longer supporter by libuv.

PR-URL: https://github.com/libuv/libuv/pull/1852
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-30 13:23:55 -07:00
Bert Belder
e318e001ea
Revert "win: add Windows XP support to uv_if_indextoname()"
Libuv is not supported on Windows XP, as stated in the
SUPPORTED_PLATFORMS document. It also can't possibly work because
`ReOpenFile()` in src/win/fs.c is not weakly linked, so any executable
that links libuv would simply fail to load on XP.

This reverts commit 17eaa956bd.

Refs: https://github.com/libuv/libuv/pull/1810
PR-URL: https://github.com/libuv/libuv/pull/1854
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-30 13:20:35 -07:00
Ben Noordhuis
585dc821f3 test: use custom timeout for getaddrinfo_fail_sync
We don't control the running time of the test and as a result it
frequently times out on some of the CI buildbots.

We are already using a custom timeout for getaddrinfo_fail so it only
makes sense to do the same for its synchronous counterpart.

PR-URL: https://github.com/libuv/libuv/pull/1856
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-05-30 14:41:23 +02:00
Ben Noordhuis
2256be01b0 unix: catch some cases of watching fd twice
Libuv does not support multiple handles watching the same file
descriptor.  That condition is caught by an assert but it's detached
from the call site and therefore not always trivial to track down.

This commit turns cases where we can easily detect duplicates into
runtime `UV_EEXIST` errors.  More work is needed to catch _all_ cases.

Partially addresses https://github.com/libuv/libuv/issues/1172.

PR-URL: https://github.com/libuv/libuv/pull/1851
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-05-30 13:24:19 +02:00
Bert Belder
4e53af9120
win,pipe: fix IPC pipe deadlock
This fixes a bug where IPC pipe communication would deadlock when both
ends of the pipe are written to simultaneously, and the kernel pipe
buffer has already been filled up by earlier writes.

The root cause of the deadlock is that, while writes to an IPC pipe are
generally asynchronous, the IPC frame header is written synchronously.
So when both ends of the pipe are sending a frame header at the same
time, neither will read data off the pipe, causing both header writes
to block indefinitely.

Additionally, this patch somewhat reduces the spaghetti level in
win/pipe.c.

Fixes: https://github.com/libuv/libuv/issues/1099
Refs: https://github.com/nodejs/node/issues/7657
Refs: https://github.com/electron/electron/issues/10107
Refs: https://github.com/parcel-bundler/parcel/issues/637
Refs: https://github.com/parcel-bundler/parcel/issues/900
Refs: https://github.com/parcel-bundler/parcel/issues/1137
PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 13:02:22 -07:00
Bert Belder
421d7571a3
test: add test for IPC deadlock on Windows (#1099)
PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 13:01:59 -07:00
Bert Belder
b6eb3cef46
test: improve output from IPC test helpers
PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2018-05-29 13:01:44 -07:00