forked from libuv/libuv
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] v1.x from libuv:v1.x #190
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
Open
pull
wants to merge
826
commits into
bazelregistry:v1.x
Choose a base branch
from
libuv:v1.x
base: v1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+28,812
−17,022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The SQPOLL io_uring instance wasn't providing consistent behaviour to users depending on kernel versions, load shape, ... creating issues difficult to track and fix. Don't use this ring by default but allow enabling it by calling `uv_loop_configure()` with `UV_LOOP_ENABLE_IO_URING_SQPOLL`.
Refactor / cleanup arithmetic for unix -> win filetime conversion in order to avoid multiplication overflow. Fixes: ``` src/win/fs.c:106:48: runtime error: signed integer overflow: 1702781567 * 10 cannot be represented in type 'long' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/win/fs.c:106:48 in ``` Co-authored-by: Jameson Nash <vtjnash@gmail.com>
POSIX allows `rmdir` to return `EEXIST` or `ENOTEMPTY` for a non-empty directory, so the test needs to allow both.
All other checks for `UV_RENAME` in `test-fs-event` also allow `UV_CHANGE`.
Autobinding is a feature that lets the kernel pick a name for the abstract socket, instead of userspace having to provide one. Two bugs that this change exposed are also fixed: 1. strlen(sa.sun_path) can read past the end if the file path is exactly sizeof(sa.sun_path) long (use memchr instead), and 2. don't return UV_ENOBUFS for abstract sockets when the buffer is exactly large enough to hold the result; per commit e5f4b79, abstract socket names are not zero-terminated
Establishes a user event for kqueue to eliminate the overhead of the pipe and the system call read(2) per wakeup event. --------- Signed-off-by: Andy Pan <i@andypan.me> Co-authored-by: Jameson Nash <vtjnash@gmail.com>
They have no return value.
In #4470, I accidentally copied the bug from unix, where calling uv_stream_set_blocking can cause the whole process to hang on a read. However, unlike unix, where libuv attempts to set the O_NONBLOCK flag in uv_pipe_open (as long as the handle never gets passed to uv_spawn), the NT kernel is not capable of enabling OVERLAPPED operation later (but fortunately, it also cannot disable it later too). This implementation might be good to copy to unix (using FIONREAD) to address the same bug that happens there if the user has called uv_spawn or uv_stream_set_non_blocking on this handle in the past.
Use GetProcessAffinityMask() to estimate the available parallelism. Before this commit, it simply used the number of available CPUs. Fixes: #4520
Get parent process ID using NtQueryInformationProcess, it's faster than using CreateToolhelp32Snapshot.
Yet another followup to #4511. The functional/legacy/increment_spec.lua test failed most of the time without this, and passes consistently with it. It seemed unexpected this code path gets reached (perhaps imply that the user wrote zero bytes?), but good to fix of course.
Follows up on #659. Signed-off-by: Andy Pan <i@andypan.me>
Libuv stores the `struct termios` for use inside uv_tty_reset_mode(). Node.js uses said function to restore the tty to its original mode on SIGINT or SIGTERM, when there is no opportunity to shut down the process normally. Track uv_tty_t handle closing, otherwise we might be trying to use a stale termios. The current solution is not ideal because there can be multiple handles that refer to the same tty/pty and, for various reasons, we can't really determine when we close the last handle. The last handle may not even be inside the current process. Still, all things considered, it's probably (hopefully!) an improvement over the status quo. Refs: #4398
Delete the fs_event_error_reporting test. It fails in different ways, most frequently on the TSan sanitizer buildbot, due to running out of file descriptors when that is not expected, or vice versa, *not* running out of file descriptors when that *is* expected. The test creates a large number of event loops and expects to, eventually, hit EMFILE but it sometimes hits it too early, and sometimes not at all. I don't think TSan is really responsible here, it just makes the invalid assumption in the test itself more visible. Fixes: #4368
Fixes: #4533 Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
Both gcc 11 and 12 emit wrong code for a function call pointer in one very specific context. Fixes: #4532
--------- Signed-off-by: Andy Pan <i@andypan.me>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Fetch file metadata by handle instead of by path, otherwise there is a race window between fetching and acting on said metadata where another process can replace the file with another one. There is still a potential race when upgrading the short path to a long path but that that one is intrinsic. It's not something libuv can solve except by refraining from calling GetLongPathName. Fixes: #4568
Remove the microsecond truncation in uv__fs_to_timespec() function to enable full nanosecond resolution support. The utimensat() system call already supports nanosecond precision, so the artificial truncation to microseconds is no longer necessary. This allows file modification and access times to be set with full nanosecond precision instead of being limited to microsecond resolution. Fixes the TODO comment about removing the microsecond resolution limit.
The initial FindFirstFile can fail with ERROR_FILE_NOT_FOUND, meaning no matches (read: empty directory), which leaves dir_handle set to INVALID_HANDLE_VALUE. Not an actual error, it just means no results. I can't get FindFirstFile to work like that on regular file systems but it's been reported that it does under sshfs-win and the MSDN documentation clearly states it's possible. Handle it. Fixes: #4952
Added `TEST_FS_DECLARE`, `TEST_FS_ENTRY` and `TEST_FS_IMPL` so we can run test-fs.c tests both using the threadpool and io_uring implementations.
The `offset` field should be assigned to ithe `io_uring_sqe.off` field.
Add macos-15 runners. Remove the deprecated macos-13 runners. Fixes: #4965 Refs: actions/runner-images#10924
And fix a stupid typo that made GHA skip running the tests 🤦
Use GetFileInformationByHandleEx(FileBasicInfo) instead of GetFileInformationByHandle() because it's cheaper -- one syscall, instead of two [1] [1]: https://blog.axiorema.com/engineering/hidden-cost-getfileinformationbyhandle/
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6 to 7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v6...v7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v5...v6) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fix `threadpool_cancel_fs_iouring` so it takes `UV_FS_FTRUNCATE` into account.
If uv_spawn() fails after uv__handle_init() has been called, the handle remains in loop->handle_queue. This causes use-after-free if the handle is stack-allocated or freed, and a subsequent loop operation like uv_walk() accesses it. This follows the same pattern as uv_tcp_init_ex() which explicitly removes the handle from the queue on error.
As of January 1, 2026, HP-UX is well and truly dead. Remove it.
Zero the struct. The compiler is not aware it's not actually used.
Check the length before doing the compare like we do a few lines below,
not the other way around. It's a false positive because the length is
capped well below the maximum object size but it's an easy fix.
Fixes the following warning:
test/test-poll-oob.c:94:19: warning: ‘strncmp’ specified bound
[18446744071562067968, 18446744073709551615] exceeds maximum
object size 9223372036854775807 [-Wstringop-overread]
AddressSanitizer was right to complain about the test because it was passing an uninitialized `struct winsize` to openpty().
This adds support for "Linux"-style Windows symbolic links, reparse tag 0xA000001D (IO_REPARSE_TAG_LX_SYMLINK).
It was reported that PTYs on Linux sometimes report POLLHUP, return a partial read, but still return more data on the next read. Libuv contains an optimization where it assumes a partial read after POLLHUP means the next read can be skipped because it's going to fail with EOF anyway. That assumption was thought to be always true but, alas, it isn't. The fact the optimization has been present for 13 years and this is the first bug report about it, indicates how rare this particular condition is, but of course we can't skim on correctness. The reworked optimization only uses POLLHUP as an input signal when POLLIN is not also set. That means we no longer have to track partial reads because we're going to try and read anyway as long as POLLIN is set. It seems to cause no measurable regressions on the test suite or the (lightly tested) benchmarks. Fixes: #4992
The test is multi-threaded and expects both threads to receive at least some of the incoming datagrams but there isn't always true parallelism under QEMU's user-mode emulator. Single-core systems are also susceptible to that so also add a check that we have at least two cores to run on. It's not perfect because a sufficiently dedicated test torturer could probably concoct a containerized setup where the core count > 1 but the available CPU slice is so small that the test effectively still runs sequentially, but it's better than nothing. Fixes: #4777
The test is multi-threaded and expects both threads to receive at least some of the incoming connections but there isn't always true parallelism under QEMU's user-mode emulator. Single-core systems are also susceptible to that so also add a check that we have at least two cores to run on. As mentioned in the change for the udp_reuseport test from a few days ago, the test is not perfect (there being > 1 core doesn't guarantee we actually get to run on them) but it's better than nothing. Fixes: #5003
Catch sign conversion bugs by introducing a bounds check that doubles as a sanity check. Fixes: #5012
Accomplish this by replacing `GetDiskFreeSpaceW()` with `NtQueryVolumeInformationFile()` which allows us to represent blocks larger than 2^32 - 1 via `FILE_FS_FULL_SIZE_INFORMATION.TotalAllocationUnits`. Expanded `fs_statfs` test to check that `uv_fs_statfs()` also works with files, meaning #2683 remains fixed without the need of #2695.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )