Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] v1.x from libuv:v1.x #28

Open
wants to merge 588 commits into
base: v1.x
Choose a base branch
from
Open

[pull] v1.x from libuv:v1.x #28

wants to merge 588 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 13, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Jan 13, 2022
devnexen and others added 29 commits October 12, 2023 20:43
Also introduce a new ASSERT_PTR_LT macro.
Under heavy workloads pthread_cond_wait on macOS can return EINVAL while
all the input parameters are correct.

As it happens due to a syscall having an errno of EBUSY we can detect it
and work around it.

Fixes: #4165
Section 3 of rfc 5737 lists 192.0.2.0/24 as TEST-NET-1,
fix confusion about /8 and /24.
Implement in terms of pread/pwrite and only try to read/write the first
buffer. Callers are supposed to handle partial reads and libuv takes
care of partial writes.

(Our own fs_read_bufs test doesn't but that's fine because this commit
is a fix-up for unsupported platforms that aren't in our CI matrix.)

Fixes: #4176
uv__fs_write_do() calls it `r` so call it that in `uv__fs_read_do()`
too.
I split those out in a previous commit in anticipation of changes that
never came. Let's merge them back.
The recently added support for minidumps use SHGetKnownFolderPath which
requires shell32.lib - for some reason the builds work without that on
x64, while failing on arm.
The workaround for preadv/pwritev is needed only
for Solaris, not illumos, so avoid it on illumos.

Haiku R1/prebeta5 (and later) provide preadv and
pwritev, so only use workaround on lower versions.

Signed-off-by: Jeffrey H. Johnson <[email protected]>
It's been reported that no released kernels are bug-free enough to use
io_uring without causing regressions.

Fixes: #4158
Skip three fs_event tests that time out under Thread Sanitizer.
As promised in #2970, this attempts to migrate code to a common set of
utilities in a common place in the code and use them everywhere. This
also exports the functionality, since the Windows API with
WideCharToMultiByte is fairly verbose relative to what libuv and
libuv's clients typically need, so it is useful not to require clients
to reimplement this conversion logic unnecessarily (and because Windows
is not 64-bit ready here, but this implementation is.)
This makes cmake more consistent about how to name this file, otherwise
sometimes it names it uv.lib and sometimes libuv.a depending on which
compiler is selected or if ./configure is used.

Refs: #2085 (comment)
Fixes a detected error: incompatible pointer to integer conversion
passing 'uv_os_fd_t' (aka 'void *') to parameter of type 'SOCKET' (aka
'unsigned long long').

Use upstream llvm to work-around broken VS2022 clang unable to link.
uv_os_uname() on Windows queries the registry value "HKEY_LOCAL_MACHINE\
SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" to fill
uv_utsname_t. If calling application was compiled for x86 and run on a
x86_64 host, that query is redirected to "Computer\HKEY_LOCAL_MACHINE\
SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\ProductName"
instead.

For whatever reason, the value of 'ProductName' in the 32-bit registry
section on 64-bit Windows sometimes differs from the 64-bit equivalent
value and is inaccurate (e.g. containing the data
"Windows 10 Enterprise" while the 64-bit value accurately contains
"Windows 10 Pro").

Adds the 'KEY_WOW64_64KEY' security descriptor when opening the
appropriate registry key so that the value of ProductName is always
taken from the primary registry on 64-bit systems, regardless of
compiled architecture. The descriptor is safely ignored on 32-bit hosts.
Changes since version 1.46.0:

* test: fix license blurb (Ben Noordhuis)

* linux: fix harmless warn_unused_result warning (Shuduo Sang)

* darwin: fix build warnings (小明)

* linux: don't use io_uring on pre-5.10.186 kernels (Ben Noordhuis)

* fs: fix WTF-8 decoding issue (Jameson Nash)

* test: enable disabled tcp_connect6_error_fault (Ben Noordhuis)

* test: enable disabled fs_link (Ben Noordhuis)

* test: enable disabled spawn_same_stdout_stderr (Ben Noordhuis)

* linux: handle UNAME26 personality (Ben Noordhuis)

* build: move cmake_minimum_required version to 3.9 (Keith Winstein)

* unix: set ipv6 scope id for link-local addresses (Ben Noordhuis)

* unix: match kqueue and epoll code (Trevor Norris)

* win,spawn: allow `%PATH%` to be unset (Kyle Edwards)

* doc: switch to Furo, a more modern Sphinx theme (Saúl Ibarra Corretgé)

* darwin: make TCP_KEEPINTVL and TCP_KEEPCNT available (小明)

* win,fs: avoid winapi macro redefinition (Brad King)

* linux: add missing riscv syscall numbers (michalbiesek)

* doc: fix broken "Shared library" Wikipedia link (Alois Klink)

* unix: get mainline kernel version in Ubuntu (Santiago Gimeno)

* unix: get mainline kernel version in Debian (Ben Noordhuis)

* build: fix qemu install in CI-unix workflow (Santiago Gimeno)

* unix: disable io_uring close on selected kernels (Santiago Gimeno)

* test: skip tests when ipv6 is not available (Santiago Gimeno)

* ibmi: implement ifaddrs, getifaddrs, freeifaddrs (Abdirahim Musse)

* unix: reset signal counters after fork (SmorkalovG)

* win,process: avoid assert after spawning Store app (Jameson Nash)

* unix: remove pread/preadv conditionals (Ben Noordhuis)

* unix: remove pwrite/pwritev conditionals (Ben Noordhuis)

* darwin: remove workaround for data corruption bug (Ben Noordhuis)

* src: default to stream=stderr in handle printer (Ben Noordhuis)

* test: switch to new-style ASSERT_EQ macros (Pleuvens)

* zos: correctly get cpu model in uv_cpu_info() (jolai)

* test: fix get_passwd2 on IBM i (Abdirahim Musse)

* unix: don't malloc on sync uv_fs_read (Ben Noordhuis)

* freebsd: get fs event path with fcntl(F_KINFO) (David Carlier)

* test: switch from ASSERT_* to ASSERT_PTR_* (Pleuvens)

* darwin: workaround apple pthread_cond_wait bug (Julien Roncaglia)

* doc: uv_close should be called after exit callback (Pleuvens)

* test: 192.0.2.0/24 is the actual -TEST-NET-1 (prubel)

* unix: add back preadv/pwritev fallback (Ben Noordhuis)

* unix: rename variable for consistency (Ben Noordhuis)

* unix: merge read/write code into single functions (Ben Noordhuis)

* doc: filename arg to uv_fs_event_cb can be NULL (Ben Noordhuis)

* build,win: we need to link against shell32.lib (Per Allansson)

* unix: no preadv/pwritev workaround if not needed (Jeffrey H. Johnson)

* build: add CI for Windows ARM64 (build only) (Per Allansson)

* linux: disable io_uring on 32 bits arm systems (Ben Noordhuis)

* build: run sanitizers on macos ci (Ben Noordhuis)

* misc: export WTF8 conversion utilities (Jameson Nash)

* build: fix libuv.a file name for cmake (Jameson Nash)

* build: add windows ubsan and clang ci (Matheus Izvekov)

* win: improve accuracy of ProductName between arch (Christian Heimlich)
uv_run_tests.exe fails to start up with exit code 0xC0000135 a.k.a.
STATUS_DLL_NOT_FOUND, suggesting it cannot find the ASAN runtime
libraries. Disable the buildbot until we figure out how to fix that.

Refs: #4210
The test is prone to time out at the best of times, never mind when
running under MemorySanitizer.
I suggested in #4182 to add the flag
to configure.ac as well but seems we already link to it.

I've removed the first one, not the second one, in case libuv is linked
with --as-needed.
Passing this to uv__is_ipv6_link_local() is causing a segmentation
fault. Note that the documentation for getifaddrs() explicitly states
that this value may be NULL.

Signed-off-by: Stephen Gallagher <[email protected]>
Add uv_thread_setpriority for setting priority for threads created by
uv_thread_create. Add uv_thread_getpriority for getting thread priority.

For Linux by default, if the scheduling policy is SCHED_OTHER and the
priority is 0, we need to set the nice value.

Fixes: #4051
This was incorrectly dropped by #4030, where previously connecting to ""
might fail eventually, now instead it would return EINVAL and then fail
to initialize the struct or call the callback.
saghul and others added 30 commits December 12, 2024 15:55
The OG MinGW has been dead for years, MinGW-w64 has taken its place.
Replaces: #4504
Fixes: #1980
Fixes: #3267

Co-authored-by: Hüseyin Açacak <[email protected]>
This commit documents a FreeBSD kernel issue where uv_fs_event can
receive a NULL filename and updates test-fs-event.c to skip filename
assertions on FreeBSD.

* Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197695

Refs: #4606

Signed-off-by: Juan José Arboleda <[email protected]>
Shuffle around and DRY the sendmsg logic in preparation for
uv_udp_try_send2(). NFC barring bugs.

This work was sponsored by ISC, the Internet Systems Consortium.
Add a version of uv_udp_try_send that can send multiple datagrams.

Uses sendmmsg(2) on platforms that support it (Linux, FreeBSD, macOS),
falls back to a regular sendmsg(2) loop elsewhere.

This work was sponsored by ISC, the Internet Systems Consortium.
Replace comparison of `alloc_cb_called` with the total bytes
read (`bytes_read`) to validate the test's correctness.

Fixes: #4650
Signed-off-by: Juan José Arboleda <[email protected]>
This patch will update Android API in CI to 29 and will set up the fdsan
in the test runner.

Signed-off-by: Juan José Arboleda <[email protected]>
Fixes: #4369
Refs: #3119

Signed-off-by: Juan José Arboleda <[email protected]>
Co-authored-by: James M Snell <[email protected]>
Changes since version 1.49.2:

* ci: run macOS and iOS tests also on macOS 14 (Saúl Ibarra Corretgé)

* unix,win: map ENOEXEC errno (Saúl Ibarra Corretgé)

* test: skip multicast join test on ENOEXEC (Saúl Ibarra Corretgé)

* ci: make sure the macOS firewall is disabled (Saúl Ibarra Corretgé)

* darwin,test: squelch EBUSY error on multicast join (Saúl Ibarra
  Corretgé)

* build: update minimum cmake to 3.10 (Ben Noordhuis)

* kqueue: use EVFILT_USER for async if available (Jameson Nash)

* unix,win: fix off-by-one in uv_wtf8_to_utf16() (Ben Noordhuis)

* doc: add scala-native-loop to LINKS.md (Julian A Avar C)

* unix: fix build breakage on haiku, openbsd, etc (Jeffrey H. Johnson)

* kqueue: lower overhead in uv__io_check_fd (Andy Pan)

* doc: move cjihrig back to active maintainers (cjihrig)

* build(deps): bump actions/checkout from 3 to 4 (dependabot[bot])

* unix,pipe: fix handling null buffer in uv_pipe_get{sock,peer}name
  (Saúl Ibarra Corretgé)

* unix,win: harmonize buffer checking (Saúl Ibarra Corretgé)

* unix,win: add support for detached threads (Juan José Arboleda)

* src: add uv_thread_set/getname() methods (Santiago Gimeno)

* build: fix qemu builds (Ben Noordhuis)

* win: drop support for windows 8 (Ben Noordhuis)

* linux: fix uv_cpu_info() arm cpu model detection (Ben Noordhuis)

* linux: always use io_uring for epoll batching (Ben Noordhuis)

* doc: clarify repeating timer behavior more (Ben Noordhuis)

* unix,win: handle nbufs=0 in uv_udp_try_send (Ben Noordhuis)

* win: use GetQueuedCompletionStatusEx directly (Saúl Ibarra Corretgé)

* win: enable uv_thread_{get,set}name on MinGW (Saúl Ibarra Corretgé)

* win: drop support for the legacy MinGW (Saúl Ibarra Corretgé)

* win,fs: get (most) fstat when no permission (Jameson Nash)

* win: plug uv_fs_event_start memory leak (amcgoogan)

* test: address FreeBSD kernel bug causing NULL path in fsevents (Juan
  José Arboleda)

* unix: refactor udp sendmsg code (Ben Noordhuis)

* unix,win: add uv_udp_try_send2 (Ben Noordhuis)

* test: fix flaky flaky udp_mmsg test (Juan José Arboleda)

* build: enable fdsan in Android (Juan José Arboleda)

* test: fix udp-multicast-join for FreeBSD (Juan José Arboleda)

* win: fix leak processing fs event (Saúl Ibarra Corretgé)

* src: set a default thread name for workers (Rafael Gonzaga)

* misc: implement uv_getrusage_thread (Juan José Arboleda)
Said symbols are not by default available on Windows Server 2016 but
libuv can still use them when
api-ms-win-core-processthreads-l1-1-3.dll is present.

Fixes: #4677
The CreateProcess API on Windows is still not longPathAware,
even if the process itself is. So, if the cwd used for CreateProcess
is too long, then the call fails with a 'INVALID_DIRECTORY' error.

To deal with this, check the length of the cwd and shorten it if it
is longer than MAX_PATH.
On macOS, when calling `spawn`, the child process's stdio buffer
size is 8192 bytes. This is due to the AF_UNIX socket buffer size
being 8192 bytes in the XNU kernel.

When large amounts of data are transferred through the child
process's stdio, this buffer size can cause performance issues.
To mitigate this, the buffer size has been increased to 65536
bytes, aligning it with the behavior on Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.