Commit Graph

4951 Commits

Author SHA1 Message Date
Jameson Nash
e8b7eb6908 2022.03.09, Version 1.44.1 (Stable)
Changes since version 1.44.0:

* process: simplify uv__write_int calls (Jameson Nash)

* macos: don't use thread-unsafe strtok() (Ben Noordhuis)

* process: fix hang after NOTE_EXIT (Jameson Nash)
2022-03-09 12:54:54 -05:00
Jameson Nash
bae2992cb0
process: fix hang after NOTE_EXIT (#3521)
Bug #3504 seems to affect more platforms than just OpenBSD. As this
seems to be a race condition in these kernels, we do not want to fail
because of it. Instead, we remove the WNOHANG flag from waitpid, and
track exactly which processes have exited. Should also be a slight speed
improvement for excessively large numbers of live children.
2022-03-09 12:25:51 -05:00
Ben Noordhuis
3c569c00df
macos: don't use thread-unsafe strtok() (#3524)
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2022-03-09 11:06:39 +01:00
Jameson Nash
4296fec7f5
process: simplify uv__write_int calls (#3519) 2022-03-07 17:07:49 -05:00
Jameson Nash
761de533b2 Now working on version 1.44.1
Fixes: https://github.com/libuv/libuv/issues/3452
2022-03-07 12:18:03 -05:00
Jameson Nash
8367fc2aac Add SHA to ChangeLog 2022-03-07 11:39:19 -05:00
Jameson Nash
d2bff50845 2022.03.07, Version 1.44.0 (Stable)
Changes since version 1.43.0:

* darwin: remove EPROTOTYPE error workaround (Ben Noordhuis)

* doc: fix v1.43.0 changelog entries (cjihrig)

* win: replace CRITICAL_SECTION+Semaphore with SRWLock (David Machaj)

* darwin: translate EPROTOTYPE to ECONNRESET (Ben Noordhuis)

* android: use libc getifaddrs() (Ben Noordhuis)

* unix: fix STATIC_ASSERT to check what it means to check (Jessica
  Clarke)

* unix: ensure struct msghdr is zeroed in recvmmsg (Ondřej Surý)

* test: test with maximum recvmmsg buffer (Ondřej Surý)

* unix: don't allow too small thread stack size (Ben Noordhuis)

* bsd: ensure mutex is initialized (Ben Noordhuis)

* doc: add gengjiawen as maintainer (gengjiawen)

* process: monitor for exit with kqueue on BSDs (Jeremy Rose)

* test: fix flaky uv_fs_lutime test (Momtchil Momtchev)

* build: fix cmake install locations (Jameson Nash)

* thread,win: fix C90 style nit (ssrlive)

* build: rename CFLAGS to AM_CFLAGS (Jameson Nash)

* doc/guide: update content and sample code (woclass)

* process,bsd: handle kevent NOTE_EXIT failure (Jameson Nash)

* test: remove flaky test ipc_closed_handle (Ben Noordhuis)

* darwin: bump minimum supported version to 10.15 (Ben Noordhuis)

* win: return fractional seconds in uv_uptime() (Luca Adrian L)

* build: export uv_a for cmake (WenTao Ou)

* loop: add pending work to loop-alive check (Jameson Nash)

* win: use GetTickCount64 for uptime again (Jameson Nash)

* win: restrict system DLL load paths (jonilaitinen)

* win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES (Darshan Sen)

* bench: add `uv_queue_work` ping-pong measurement (Momtchil Momtchev)

* build: fix error C4146 on MSVC (UMU)

* test: fix benchmark-ping-udp (Ryan Liptak)

* win,fs: consider broken pipe error a normal EOF (Momtchil Momtchev)

* document the values of enum uv_stdio_flags (Paul Evans)

* win,loop: add missing uv_update_time (twosee)

* win,fs: avoid closing an invalid handle (Jameson Nash)

* fix oopsie from

* doc: clarify android api level (Ben Noordhuis)

* win: fix style nits [NFC] (Jameson Nash)

* test: fix flaky udp_mmsg test (Santiago Gimeno)

* test: fix ipc_send_recv_pipe flakiness (Ben Noordhuis)

* doc: checkout -> check out (wyckster)

* core: change uv_get_password uid/gid to unsigned (Jameson Nash)

* hurd: unbreak build on GNU/Hurd (Vittore F. Scolari)

* freebsd: use copy_file_range() in uv_fs_sendfile() (David Carlier)

* test: use closefd in runner-unix.c (Guilherme Íscaro)

* Reland "macos: use posix_spawn instead of fork" (Jameson Nash)

* android: fix build error when no ifaddrs.h (ssrlive)

* unix,win: add uv_available_parallelism() (Ben Noordhuis)

* process: remove OpenBSD from kevent list (Jameson Nash)

* zos: fix build breakage (Ben Noordhuis)

* process: only use F_DUPFD_CLOEXEC if it is defined (Jameson Nash)

* win,poll: add the MSAFD GUID for AF_UNIX (roflcopter4)

* unix: simplify uv__cloexec_fcntl() (Ben Noordhuis)

* doc: add secondary GPG ID for vtjnash (Jameson Nash)

* unix: remove uv__cloexec_ioctl() (Jameson Nash)
2022-03-07 11:39:08 -05:00
Jameson Nash
20a2b1c341
unix: remove uv__cloexec_ioctl() (#3515)
Now that uv__cloexec_fcntl() is simplified
(https://github.com/libuv/libuv/pull/3492), there is no benefit to
maintaining duplicate code paths for the same thing.
2022-03-06 15:01:33 -05:00
Jameson Nash
538d718ff4
doc: add secondary GPG ID for vtjnash 2022-03-05 13:07:13 -05:00
Ben Noordhuis
c8583bbdf1
unix: simplify uv__cloexec_fcntl() (#3492)
FD_CLOEXEC is the only defined flag for fcntl(F_SETFD) so don't bother
getting the status of that flag first with fcntl(F_GETFD), just set it.
2022-03-05 12:55:49 -05:00
roflcopter4
8e67d8b364
win,poll: add the MSAFD GUID for AF_UNIX (#3511)
Enables the "fast poll" mechanism for the new(ish) Unix sockets in
Windows 10.
2022-03-05 12:54:41 -05:00
Jameson Nash
6ac063d10e
process: only use F_DUPFD_CLOEXEC if it is defined (#3512)
We can save a syscall on most modern systems (required by POSIX 2008),
but not on all systems.

Also handle errors from CLOEXEC. Even though fcntl does not really
define there to be any, it could theoretically be EBADF if the user
happened to pass a bad file descriptor to the same number fd (such that
no other code happened to already fail on that).
2022-03-05 12:52:04 -05:00
Ben Noordhuis
fd34b17f90
zos: fix build breakage (#3513)
Introduced earlier today in commit f250c6c7. _SC_NPROCESSORS_ONLN does
not seem to be defined on that platform.
2022-03-05 10:12:26 +01:00
Jameson Nash
60fbcad9ac
process: remove OpenBSD from kevent list (#3506)
From user reports, it appears that OpenBSD has a broken kevent NOTE_EXIT
implementation. However, we can simply go back to the old, slower
version therefore.

Fix: https://github.com/libuv/libuv/issues/3504
2022-03-04 21:38:31 -05:00
Ben Noordhuis
f250c6c73e
unix,win: add uv_available_parallelism() (#3499)
Replacement for the usage pattern where people use uv_cpu_info() as an
imperfect heuristic for determining the amount of parallelism that is
available to their programs.

Fixes #3493.
2022-03-04 22:35:14 +01:00
ssrlive
c40f8cb9f8
android: fix build error when no ifaddrs.h (#3505) 2022-03-03 13:18:28 +01:00
Jameson Nash
83efa3dd71
Reland "macos: use posix_spawn instead of fork" (#3257)
Fixes: https://github.com/libuv/libuv/issues/3050
Refs: https://github.com/libuv/libuv/issues/3086
Refs: https://github.com/libuv/libuv/pull/3064
Refs: https://github.com/libuv/libuv/pull/3107
Refs: https://github.com/libuv/libuv/pull/3064

This reverts commit 217fdf4265, then fixes
several issues with it:

* remove error fast-cleanup code that triggers a nodejs bug

Refs: https://github.com/libuv/libuv/pull/3107#issuecomment-782482608

* protect posix_spawn from EINTR

This is not a documented valid error, but seems to have been observed.

* ignore setuid/setgid syscall

This kernel function is not permitted unless the process is setuid root,
so disable this syscall. Falling back to fork/exec should be okay for
the rare cases that the user decides they need to do setuid(getuid()) or
setuid(geteuid()) for the child.

Refs: https://github.com/libuv/libuv/pull/3107#issuecomment-782482608

* improve posix_spawn path search

Ports the improvements in musl back to this function

* fix some additional problems and formatting issues

We previously might fail to start a watcher, in rare failure cases,
resulting in a zombie that we would fail to kill. Also avoid creating
the signal-pipe unless required (addresses a review comment from Apple)

* fix fd->fd mapping reuse

There was a chance that when duplicating the fd's into stdio_count+fd we
might be closing a currently opened fd with that value.
2022-03-02 15:15:39 -05:00
Guilherme Íscaro
56e279021f
test: use closefd in runner-unix.c (#3497)
This commit changes the plain close calls to
the closefd function, which will properly check if
close() returns an error.
2022-02-27 11:49:58 +01:00
David CARLIER
993e9ebd07
freebsd: use copy_file_range() in uv_fs_sendfile() (#3496)
Use copy_file_range() on FreeBSD 13 and above.
2022-02-27 11:49:29 +01:00
Vittore F. Scolari
7ae0c9543d
hurd: unbreak build on GNU/Hurd (#3450)
The GNU/Hurd platform does not define IP_ADD_SOURCE_MEMBERSHIP,
IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_SOURCE_GROUP and 
MCAST_LEAVE_SOURCE_GROUP.

Implement a few functions for the GNU/Hurd. Specifically:

* uv_resident_set_memory (from Linux)
* uv_get_free_memory (from Linux)
* uv_get_total_memory (from Linux)
* uv_cpu_info (from cygwin)
* uv__process_title_cleanup (void)
* uv_get_constrained_memory (stub)
* Leave proctitle unimplemented on Hurd for now
* Implement hurdish uv_exepath
* Enable ifaddrs api
* Unbreak udp basics
* Unbreak futime and lutime on Hurd
2022-02-23 12:04:18 -05:00
Jameson Nash
f3e0bffcb1
core: change uv_get_password uid/gid to unsigned (#3476)
Added in https://github.com/libuv/libuv/pull/742, these values are
typically defined as unsigned (since Linux 2.4). Only -1 is special,
representing an invalid id (e.g. see setreuid).
2022-02-22 10:59:06 -05:00
wyckster
c2a345fa67
doc: checkout -> check out (#3489)
"check out" is a verb phrase, but "checkout" is a noun. Since it is
being used as a verb, the spelling "check out" is required.
2022-02-22 10:58:43 -05:00
Ben Noordhuis
e0a5f58d2c
test: fix ipc_send_recv_pipe flakiness (#3478)
The read callback failed to handle the `nread == 0` case, which is rare
to non-existent on the systems we test on but apparently happens often
enough on Solaris on SPARC to draw attention.

Fixes #3469.
2022-02-20 12:17:13 +01:00
Santiago Gimeno
2bc22c40eb test: fix flaky udp_mmsg test
Take into account that the data may not be already available in the
socket causing the `recvmsg()` / `recvmmsg()` calls to return `EAGAIN`
or `EWOULDBLOCK`.

Fixes: https://github.com/libuv/libuv/issues/3479
2022-02-17 17:34:36 +01:00
Jameson Nash
d54c92e3e6
win: fix style nits [NFC] (#3474)
Internal functions usually have a uv__ prefix.
2022-02-15 10:13:24 -05:00
Ben Noordhuis
d41a9a07e4
doc: clarify android api level (#3480)
Google goes to great lengths to obscure the relationship between the two
so explicitly call out the API version matching Android 7.0.
2022-02-15 10:10:22 -05:00
Jameson Nash
cc7dbaa3a1
fix oopsie from #3466 (#3475)
I created `uv__backend_timeout` to be used internally for this reason,
then forgot to use it, resulting in flaky tests and excessive trips
around the uv_run loop.

Fix #3472
2022-02-14 13:37:05 -05:00
Jameson Nash
3b2c25d223
win,fs: avoid closing an invalid handle (#3473)
While usually functional, calling CloseHandle(INVALID_HANDLE_VALUE) can
result in debug builds (and/or wine) being unhappy and aborting there.
2022-02-14 12:29:47 -05:00
twosee
0209466496
win,loop: add missing uv_update_time (#3175)
Time of loop should be updated after the IOCP wait.
2022-02-14 11:40:42 -05:00
Paul Evans
722d003076
document the values of enum uv_stdio_flags (#3039)
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2022-02-14 11:37:19 -05:00
Momtchil Momtchev
df78de04e4
win,fs: consider broken pipe error a normal EOF (#3053)
This would later get translated in src/win/error.c this way, which
previously could lead to rather confusing and inaccurate error messages.
2022-02-13 01:40:10 -05:00
Ryan Liptak
912bb8c577
test: fix benchmark-ping-udp (#2817)
- Fixes the declaration of the benchmark in benchmark-list.h (it was not
  previously runnable at all)
- Fixes the benchmark itself hanging infinitely because the data was
  being dropped via ICMP Destination Unreachable errors (meaning nread
  was always zero in pinger_read_cb)
    + The data getting lost was fixed by binding the udp socket
- Properly checks for UV_UDP_MMSG_CHUNK, just as an example of what
  should generally be done (buf_free is actually a no-op as the buf is
  allocated on the stack)
2022-02-13 01:04:41 -05:00
UMU
8ec1732af0
build: fix error C4146 on MSVC (#3271)
> error C4146: unary minus operator applied to unsigned type, result still unsigned
2022-02-13 00:57:43 -05:00
Momtchil Momtchev
636cb8633b
bench: add uv_queue_work ping-pong measurement (#3425) 2022-02-13 00:40:35 -05:00
Darshan Sen
04a35efe69
win,errors: remap ERROR_ACCESS_DENIED to UV_EACCES (#3193)
If we try to use uv_fs_rmdir on a read-only directory on Windows, it
internally calls _wrmdir, which sets _doserrno to ERROR_ACCESS_DENIED
and errno to EACCES. However, ERROR_ACCESS_DENIED is mapped to
UV_EPERM, so I believe it should be remapped to UV_EACCES.
2022-02-13 00:31:59 -05:00
jonilaitinen
cf7f70c25d
win: restrict system DLL load paths (#3395)
Currently `LoadLibraryA` call first attempts to load the given DLL from
the application working directory before loading it from the system DLL
path. This may pose a security risk if an attacker is able to place a
malicious DLL into the application working directory as that DLL will
be loaded instead of the system DLL. This is especially dangerous if
the application is running with elevated privileges.

This changes the DLL loading to use `LoadLibraryExA` method with
`LOAD_LIBRARY_SEARCH_SYSTEM32` flag which restricts the DLL load
path to system DLL path, ignoring any DLLs in the application working
directory.
2022-02-13 00:26:55 -05:00
Jameson Nash
d0e500c876
win: use GetTickCount64 for uptime again (#3470)
Reverts 442aa1f469, since this is an
improved API in Windows Vista that is now usable as a replacement. It
simplifies the code substantially, while returning nearly the same
result (on my system, the performance counters were 6 seconds behind).

The old code also did not work on Wine-5.0 (where I observed that
`data_size == data_block->HeaderLength`, and so no data was present).
2022-02-13 00:24:34 -05:00
Jameson Nash
939a05633f
loop: add pending work to loop-alive check (#3466)
Pending work may be either (on any platform) pending_queue callbacks or
(on unix) watcher_queue handles to add to the io poll object.
Previously, we might have gotten somewhat stuck if the user caused an
event to be added to one of these in the idle or prepare callbacks, or
was embedding libuv.

Refs: https://github.com/libuv/libuv/pull/3234
Refs: https://github.com/libuv/libuv/issues/3101
Refs: https://github.com/libuv/libuv/pull/3308
2022-02-13 00:12:11 -05:00
WenTao Ou
7a68f5ab4b
build: export uv_a for cmake (#3373) 2022-02-08 11:43:19 -05:00
Luca Adrian L
50c1d00839
win: return fractional seconds in uv_uptime() (#3455)
Some systems return fractional seconds, some return full seconds.
On Windows uptime was artificially rounded down.

Fixes #3447.
2022-02-08 14:23:39 +01:00
Ben Noordhuis
de24da8c11
darwin: bump minimum supported version to 10.15 (#3406)
We can't realistically claim to support 10.7 or any version that Apple
no longer supports so let's bump the baseline to something more
realistic.

Refs: https://github.com/libuv/libuv/pull/482
Refs: https://github.com/libuv/libuv/pull/3405
2022-02-08 14:18:29 +01:00
Ben Noordhuis
038086dc08
test: remove flaky test ipc_closed_handle (#3464)
The test is very flaky, both on the CI and on people's local machines.

I spent some time trying to fix it but its design is fairly questionable
and it fails to test what it should more often than not because on fast
machines no queueing of data takes place.

Fixes #2307.
2022-02-08 14:18:10 +01:00
Jameson Nash
953f901dd2
process,bsd: handle kevent NOTE_EXIT failure (#3451)
The kernel may return ESRCH if the child has already exited here.
This is rather annoying, and means we must indirectly handle
notification to our event loop of the process exit.

Refs: https://github.com/libuv/libuv/pull/3441
Refs: https://github.com/libuv/libuv/pull/3257
2022-02-01 15:27:12 -05:00
woclass
870828c8af
doc/guide: update content and sample code (#3408)
- Add `Makefile` for example codes. (cherry-pick from old uvbook repo)
- Add a new example "Default loop" to "Basics of libuv"/"Default loop"
- Document review and update: `Introduction`, `Basics of libuv`, `Filesystem`
    + Update the referenced libuv code snippet
    + Link update: http->https
    **Content Updates**:
    - `filesystem.rst`#L291-L297: Add note for `uv_fs_event_start`
    - `filesystem.rst`#L334: Add description of the callback function parameter `status`

The following examples have been tested manually in WSL2 (Ubuntu 20.04) with libuv 1.42.0:
- helloworld
- default-loop
- idle-basic
- uvcat
- uvtee
- onchange (test on macOS)

Co-authored-by: Nikhil Marathe <nsm.nikhil@gmail.com>
2022-01-31 16:52:42 -05:00
Jameson Nash
930af43437
build: rename CFLAGS to AM_CFLAGS (#3431)
The CFLAGS variable is reserved and should never be set:
https://www.gnu.org/software/automake/manual/html_node/User-Variables.html
2022-01-31 16:50:32 -05:00
ssrlive
cdced3a3ad
thread,win: fix C90 style nit (#3393) 2022-01-31 16:49:01 -05:00
Jameson Nash
125da33f82
build: fix cmake install locations (#3415)
Adds static libraries and DLL import libraries, as well as making sure
the DLLs go to the correct folder.

Closes #3414
2022-01-31 16:25:20 -05:00
Momtchil Momtchev
e89abc80ea
test: fix flaky uv_fs_lutime test (#3424)
Disable `atime` testing for symlink as this test
is dependant on a race condition on some OSes
(Linux is one) as `lstat` updates the `atime`.
As both `mtime` and `atime` are set by the same
syscall, barring an eventual kernel bug, this
test does not omit any error case.
2022-01-31 16:25:05 -05:00
Jeremy Rose
d9e90857f0
process: monitor for exit with kqueue on BSDs (#3441)
This adds a workaround for an xnu kernel bug that sometimes results in
SIGCHLD not being delivered. The workaround is to use kevent to listen
for EVFILT_PROC/NOTE_EXIT events instead of relying on SIGCHLD on *BSD.
 
Apple rdar: FB9529664
Refs: https://github.com/libuv/libuv/pull/3257
2022-01-31 14:49:22 -05:00
Jiawen Geng
bb0b4bb783
doc: add gengjiawen as maintainer (#3430) 2022-01-20 22:08:14 +08:00