Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Update to 1.32.0 #10

Merged
merged 41 commits into from
Sep 15, 2019
Merged

Update to 1.32.0 #10

merged 41 commits into from
Sep 15, 2019

Conversation

erw7
Copy link

@erw7 erw7 commented Sep 12, 2019

No description provided.

cjihrig and others added 30 commits August 9, 2019 10:57
PR-URL: libuv#2410
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: libuv#2413
PR-URL: libuv#2419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv__convert_utf8_to_utf16() always null terminates its
UTF-16 output. This commit updates the code to use L'\0'
as the terminator, instead of '\0'.

Fixes: libuv#2413
PR-URL: libuv#2419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit adds Windows support for retrieving empty
environment variables via uv_os_getenv().

Fixes: libuv#2413
PR-URL: libuv#2419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: libuv#2427
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
It looks like I managed to introduce a typo between two incarnations
of the pull request, causing the test to fail on macOS when using the
autotools dynamic library build.

I even managed to spell it correctly in the skip message, just not in
the actual environment variable lookup... I hang my head in shame at
such a silly mistake.

Fixes: libuv#2421
PR-URL: libuv#2422
Refs: libuv#2408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Keep the signal handler active after being closed until all the caught
signals have been delivered.

Fixes: libuv#2398
Fixes: libuv#2415
PR-URL: libuv#2423
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make sure the `uv_cpu_info_t` array is fully freed in case of error.
Also, make it more robust by setting `count` to `0` and `cpu_info` to
`NULL` in case of error, so a subsequent call to `uv_free_cpu_info()`
does not segfault.

Refs: libuv#2068
PR-URL: libuv#2432
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: libuv#2433
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
It resets a TCP connection by sending a RST packet. Due to some platform
inconsistencies, mixing of `uv_shutdown` and `uv_tcp_close_reset` calls
is not allowed.

Fixes: libuv#1991
PR-URL: libuv#2425
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The messages must be actually sent to the multicast address.

PR-URL: libuv#2185
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The f_files value can equal 0, making the current assertion
incorrect. Including 0 in the assertion range leads to a
type-limits compiler warning. So, this commit just removes
the redundant assertion.

Fixes: libuv#2417
PR-URL: libuv#2426
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Clarify the uv_buf_t isn't reused and the user is responsible for
freeing it in the recv/read callback.

Previously, this wasn't clear when reading only the docs for
uv_udp_recv_cb and uv_alloc_cb.

PR-URL: libuv#2438
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
PR-URL: libuv#2434
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Return `UV_EINVAL` in this case.

Fixes: libuv#2416
PR-URL: libuv#2424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
All the supported platforms support specific source multicast.

PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Use the correct socket options: `MCAST_JOIN_SOURCE_GROUP` and
`MCAST_LEAVE_SOURCE_GROUP`.
Set mreq.gsr_interface = 0 if iface_addr = NULL.

PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
To support source specific multicast operations.

PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: libuv#2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: libuv#2440
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Continuing improvement of SIGWINCH from PR libuv#2308.

Running SetWinEventHook without filtering for the specific PIDs has
significant impact on the performance of the entire system. This PR
changes the way SIGWINCH is handled.

The SetWinEventHook callback now signals a separate thread,
uv__tty_console_resize_watcher_thread. This thread calls
uv__tty_console_signal_resize() which checks if the console was actually
resized. The uv__tty_console_resize_watcher_thread makes sure to not to
call the uv__tty_console_signal_resize function more than 30 times per
second.

The SetWinEventHook will not be installed, if the PID of the
conhost.exe process that owns the console window cannot be
determinated. This can happen when a 32bit libuv app is running on a
64bit Windows.

For such cases PR libuv#1408 is partially reverted - when tty reads
WINDOW_BUFFER_SIZE_EVENT, it will also trigger a call to
uv__tty_console_signal_resize(). This will also help when the app is
running under console emulators. Documentation was also updated to
reflect that.

Refs: microsoft/terminal#1811
Refs: microsoft/terminal#410
Refs: libuv#2308

PR-URL: libuv#2381
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`_NSGetEnviron()` is not available on that platform.

PR-URL: libuv#2449
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Signed-off-by: MaYuming <maym@appexnetworks.com>
PR-URL: libuv#2447
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This mimics the behavior of the automake build, using
libuv.so.${UV_VERSION_MAJOR}.0.0 as the output file, and setting the
soname property to be libuv.so.${UV_VERSION_MAJOR}, currently ending up
like this:

    libuv.so.1.0.0
    libuv.so.1 -> libuv.so.1.0.0
    libuv.so -> libuv.so.1

The version information is extracted from the PACKAGE_VERSION string.

PR-URL: libuv#2445
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Fixes: libuv#1938
PR-URL: libuv#2431
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
bnoordhuis and others added 8 commits September 6, 2019 10:07
Build the shared library with `BUILDING_UV_SHARED=1` and export
`USING_UV_SHARED=1` to dependents so they get the right declspec.

Fixes: libuv#1938
PR-URL: libuv#2431
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The lower minimum version makes it possible to build neovim but it
should be understood that libuv tests nor supports cmake versions
that old.

PR-URL: libuv#2373
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The preprocessor was used to select a special implementation when
building on AIX using XL C++ (strangely, not XL C).  This code
implemented `cmpxchgi()` by directly reading the old value and then
calling `__compare_and_swap()`, an intrinsic that does not provide
any sort of memory barrier guarantees.  The return value was not
used, and the value read prior to the `__compare_and_swap()` call
was returned.  There is no way that this code could provide the
required semantics of the function and it causes observable data
races and strange library failures in production under load.

XL C/C++ for AIX has provided support for the GCC intrinsic used in
the GCC/Clang cases since version 12.1 of the compiler.  This
version of the compiler is old enough that it doesn't warrant a
version check.  (The compiler was released 8-Jun-2012, maintenance
ended 9-Jul-2019, and service ends 30-Apr-2020.)

This change fixes all observed atomic issues and unifies XL C/C++
with GCC/Clang.

Relevant XL C/C++ for AIX V12.1 documentation links:
  - [__compare_and_swap](https://www.ibm.com/support/knowledgecenter/en/SSGH3R_12.1.0/com.ibm.xlcpp121.aix.doc/compiler_ref/bif_compare_and_swap_compare_and_swaplp.html)
  - [__sync_val_compare_and_swap](https://www.ibm.com/support/knowledgecenter/en/SSGH3R_12.1.0/com.ibm.xlcpp121.aix.doc/compiler_ref/bif_gcc_atomic_val_comp_swap.html)

PR-URL: libuv#2455
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
PR-URL: libuv#2451
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Platforms that support O_CLOEXEC have supported it for a long time
and don't need feature detection. Libuv can just assume it works as
advertised.

The feature detection was broken for old Linux kernels because they
don't report EINVAL for unknown open() flags, they simply open the
file without setting the FD_CLOEXEC flag.

Libuv could fix that by checking afterwards with fcntl() if the flag
was actually set but it doesn't support kernels that old in the first
place so let's simplify the logic.

Fixes: libuv#2450
PR-URL: libuv#2454
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
According to http://man7.org/linux/man-pages/man2/open.2.html, the
O_DIRECT flag is Linux-specific. One must define _GNU_SOURCE to obtain
the correct definition.

However, defining _GNU_SOURCE in the headers is unhygienic and affects
the libuv consumer.

On Linux, we now define UV_FS_O_DIRECT explicitly according to
architecture, only falling back to O_DIRECT if defined, or 0 if not.

Fixes: libuv#2420
PR-URL: libuv#2441
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit contains a suggestion to hopefully improve the
documentation of uv_handle_t's member uv_loop_t.

PR-URL: libuv#2446
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Changes since version 1.31.0:

* misc: enable stalebot (Saúl Ibarra Corretgé)

* win: map ERROR_ENVVAR_NOT_FOUND to UV_ENOENT (cjihrig)

* win: use L'\0' as UTF-16 null terminator (cjihrig)

* win: support retrieving empty env variables (cjihrig)

* unix,stream: fix returned error codes (Santiago Gimeno)

* test: fix typo in DYLD_LIBRARY_PATH (Ben Noordhuis)

* unix,signal: keep handle active if pending signal (Santiago Gimeno)

* openbsd: fix uv_cpu_info (Santiago Gimeno)

* src: move uv_free_cpu_info to uv-common.c (Santiago Gimeno)

* tcp: add uv_tcp_close_reset method (Santiago Gimeno)

* test: fix udp-multicast-join tests (Santiago Gimeno)

* test: remove assertion in fs_statfs test (cjihrig)

* doc: clarify uv_buf_t usage in uv_alloc_cb (Tomas Krizek)

* win: fix typo in preprocessor expression (Konstantin Podsvirov)

* timer: fix uv_timer_start on closing timer (seny)

* udp: add source-specific multicast support (Vladimir Karnushin)

* udp: fix error return values (Santiago Gimeno)

* udp: drop IPV6_SSM_SUPPORT macro (Santiago Gimeno)

* udp: fix uv__udp_set_source_membership6 (Santiago Gimeno)

* udp: use sockaddr_storage instead of union (Santiago Gimeno)

* build,zos: add _OPEN_SYS_SOCK_EXT3 flag (Santiago Gimeno)

* test: add specific source multicast tests (Santiago Gimeno)

* include: map EILSEQ error code (cjihrig)

* win, tty: improve SIGWINCH performance (Bartosz Sosnowski)

* build: fix ios build error (MaYuming)

* aix: replace ECONNRESET with EOF if already closed (Milad Farazmand)

* build: add cmake library VERSION, SOVERSION (Eneas U de Queiroz)

* build: make include/ public in CMakeLists.txt (Ben Noordhuis)

* build: export USING_UV_SHARED=1 to cmake deps (Ben Noordhuis)

* build: cmake_minimum_required(VERSION 2.8.12) (Daniel Hahler)

* aix: Fix broken cmpxchgi() XL C++ specialization. (Andrew Paprocki)

* test: fix -Wsign-compare warning (Ben Noordhuis)

* unix: simplify open(O_CLOEXEC) feature detection (Ben Noordhuis)

* unix: fix UV_FS_O_DIRECT definition on Linux (Joran Dirk Greef)

* doc: uv_handle_t documentation suggestion (Daniel Bevenius)
@justinmk
Copy link
Member

@blueyed can you try this in neovim/neovim#10978 before we merge it here? Since we don't have CI on this repo.

@blueyed
Copy link

blueyed commented Sep 12, 2019

Works in general, but there are test failures, e.g. due to SIGWINCH showing up when setting up the terminal (neovim/neovim#10978 (comment)).

}
uv_sem_post(&uv_tty_output_lock);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libuv@7d950c0 uses a mutex here additionally: libuv@7d950c0#diff-16746be892849b2c5daf1be3613ed28cR2377-R2384

This might be the reason for getting too many (flaky) SIGWINCH events in Neovim's tests now.

Do functionaltests pass for you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libuv/libuv@7d950c0 uses a mutex here additionally: libuv/libuv@7d950c0#diff-16746be892849b2c5daf1be3613ed28cR2377-R2384

This might be the reason for getting too many (flaky) SIGWINCH events in Neovim's tests now.

Since uv__tty_console_output_handle is used in the next place https://github.com/erw7/libuv/blob/libuv-v1.32.0/src/win/tty.c#L738
in another thread, I decided that it needs to be locked using uv_tty_output_lock.

I experimentally created a branch https://github.com/erw7/libuv/tree/libuv-v1.32.0-test
that reverted to the mutex like the original change. Can you try this once?

Do functionaltests pass for you?

When I try it locally, I don't have any problems with SIGWINCH.

src/win/tty.c Outdated Show resolved Hide resolved
erw7 and others added 2 commits September 14, 2019 15:44
2019.09.10, Version 1.32.0 (Stable)

Changes since version 1.31.0:

* misc: enable stalebot (Saúl Ibarra Corretgé)

* win: map ERROR_ENVVAR_NOT_FOUND to UV_ENOENT (cjihrig)

* win: use L'\0' as UTF-16 null terminator (cjihrig)

* win: support retrieving empty env variables (cjihrig)

* unix,stream: fix returned error codes (Santiago Gimeno)

* test: fix typo in DYLD_LIBRARY_PATH (Ben Noordhuis)

* unix,signal: keep handle active if pending signal (Santiago Gimeno)

* openbsd: fix uv_cpu_info (Santiago Gimeno)

* src: move uv_free_cpu_info to uv-common.c (Santiago Gimeno)

* tcp: add uv_tcp_close_reset method (Santiago Gimeno)

* test: fix udp-multicast-join tests (Santiago Gimeno)

* test: remove assertion in fs_statfs test (cjihrig)

* doc: clarify uv_buf_t usage in uv_alloc_cb (Tomas Krizek)

* win: fix typo in preprocessor expression (Konstantin Podsvirov)

* timer: fix uv_timer_start on closing timer (seny)

* udp: add source-specific multicast support (Vladimir Karnushin)

* udp: fix error return values (Santiago Gimeno)

* udp: drop IPV6_SSM_SUPPORT macro (Santiago Gimeno)

* udp: fix uv__udp_set_source_membership6 (Santiago Gimeno)

* udp: use sockaddr_storage instead of union (Santiago Gimeno)

* build,zos: add _OPEN_SYS_SOCK_EXT3 flag (Santiago Gimeno)

* test: add specific source multicast tests (Santiago Gimeno)

* include: map EILSEQ error code (cjihrig)

* win, tty: improve SIGWINCH performance (Bartosz Sosnowski)

* build: fix ios build error (MaYuming)

* aix: replace ECONNRESET with EOF if already closed (Milad Farazmand)

* build: add cmake library VERSION, SOVERSION (Eneas U de Queiroz)

* build: make include/ public in CMakeLists.txt (Ben Noordhuis)

* build: export USING_UV_SHARED=1 to cmake deps (Ben Noordhuis)

* build: cmake_minimum_required(VERSION 2.8.12) (Daniel Hahler)

* aix: Fix broken cmpxchgi() XL C++ specialization. (Andrew Paprocki)

* test: fix -Wsign-compare warning (Ben Noordhuis)

* unix: simplify open(O_CLOEXEC) feature detection (Ben Noordhuis)

* unix: fix UV_FS_O_DIRECT definition on Linux (Joran Dirk Greef)

* doc: uv_handle_t documentation suggestion (Daniel Bevenius)
@blueyed
Copy link

blueyed commented Sep 14, 2019

@erw7
Using the branch now. Getting 4 failures: https://ci.appveyor.com/project/neovim/neovim/builds/27410288/job/lef9sk4dbdtq20bo#L12213 (still unexpected row/col output from SIGWINCH).
Feel free to push more to your test branch and trigger a rebuild by pushing an empty commit to neovim/neovim#10978.

When I try it locally, I don't have any problems with SIGWINCH.

So all the tests are passing for you?

@blueyed
Copy link

blueyed commented Sep 14, 2019

@erw7
Appears to work on MSVC?! (https://ci.appveyor.com/project/neovim/neovim/builds/27410452)

13 errors with mingw there with the rebuild (https://ci.appveyor.com/project/neovim/neovim/builds/27410452/job/y1ffp2h5e66w0wwg#L12374), so it is really flaky still.

@erw7
Copy link
Author

erw7 commented Sep 15, 2019

The test seems to pass by d97fd59 (neovim/neovim#11022).

Probably uv__tty_console_signale_resize() is called at src/win/tty.c#L833-L835 before uv__tty_console_resize_message_loop_thread() is called Therefore, the value of uv__tty_console_width and uv__tty_console_height is the initial value -1, and SIGWINGCH may have occurred.

Speaking of which, I feel like the WINDOW_BUFFER_SIZE_EVENT event occurred once after enabling ENABLE_WINDOW_INPUT.

@blueyed
Copy link

blueyed commented Sep 15, 2019

Testing this now in neovim/neovim#10978 (again).

Copy link

@blueyed blueyed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blueyed blueyed merged commit d5ff300 into neovim:nvim Sep 15, 2019
@justinmk
Copy link
Member

Is there a change that needs to go upstream? Or did it only involve our forked code?

@erw7
Copy link
Author

erw7 commented Sep 16, 2019

Is there a change that needs to go upstream? Or did it only involve our forked code?

7d950c0 causes this problem. Therefore, the problem comes from upstream.

I created libuv#2478.

@erw7 erw7 deleted the libuv-v1.32.0 branch October 17, 2019 05:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet