libuv/include
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
..
android-ifaddrs.h android: add support of ifaddrs in android 2014-03-16 23:16:25 +01:00
pthread-barrier.h android: fix compilation with new NDK versions 2017-07-25 22:50:39 +02:00
stdint-msvc2008.h build: switch to autotools 2013-07-02 01:21:16 +02:00
tree.h build: switch to autotools 2013-07-02 01:21:16 +02:00
uv-aix.h aix: improve AIX compatibility 2014-07-22 22:57:24 +02:00
uv-bsd.h unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
uv-darwin.h unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
uv-errno.h unix,windows: map EFTYPE errno 2018-05-09 12:05:46 -04:00
uv-linux.h unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
uv-os390.h zos: use custom semaphore 2018-04-18 22:24:37 +02:00
uv-posix.h unix: add a uv__io_poll impl using POSIX poll(2) 2017-05-21 16:12:19 +02:00
uv-sunos.h unix, windows: remove unneeded define 2014-05-08 09:08:33 +02:00
uv-threadpool.h unix, windows: use the same threadpool implementation 2014-06-27 14:27:04 +02:00
uv-unix.h unix: use __PASE__ on IBM i platforms 2018-03-31 16:41:53 -04:00
uv-version.h Now working on version 1.20.4 2018-05-07 18:30:48 -04:00
uv-win.h win,pipe: fix IPC pipe deadlock 2018-05-29 13:02:22 -07:00
uv.h win,pipe: properly set uv_write_t.send_handle in uv_write2() 2018-05-29 13:01:19 -07:00