Repository navigation
feat(libkernel): add pipe write events and socket low watermarks to sceKernelAdd*Event - #10645
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the exact head e673953786a79b3252b673438e45956daad61253. The added pipe-write path matches kevent handling for writable readiness, EV_EOF, and EPIPE after the read end closes; the low-watermark path uses the same stream-socket restriction and poll threshold as DescriptorLowWater. The added tests exercise both wrong pipe ends, closed-reader behavior, stream thresholds, and rejection on datagram sockets. The hosted conventions check passes, with the existing overlong debt-entry warning; the repository-local convention check reports the same warning and no errors. The PR correctly declares its dependency on #9099, which remains open. I did not independently run the product build.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
The declared dependency #9099 has merged. The current PR is still |
e673953 to
2dec842
Compare
|
@MarcZX10 thanks. Rebased on |
|
@rocklouis055 The new low-watermark assignment converts the unsigned size to int64_t without a range check. On a stream socket, size 0x8000000000000000 becomes INT64_MIN, so the data < lowWater check no longer filters ordinary readable/writable events. Please handle sizes that cannot be represented before storing the watermark, and add bounded boundary coverage around INT64_MAX and INT64_MAX+1 without allocating those sizes. Please also drop the new throw assertions for the wrong pipe ends and the datagram watermark in GuestSocketEvents.cpp (lines 73–74 and 266). They pin unimplemented behavior. Keep the pipe readiness/EOF/EPIPE and supported stream-watermark coverage; the production throws and debt can stay. The new positive pipe-write assertions are unconditional, but GuestSockets::PipeWriteState still explicitly throws on macOS. Please restrict that supported-path test to the platforms that implement pipe write readiness, while retaining the existing pipe-read and stream-watermark coverage on macOS. |
|
@oneandonlydean thanks, all three addressed in
Linux, Release: |
|
@rocklouis055 One more small change in Equeue.cpp around line 847: the new code sets event.lowWater = min(size, INT64_MAX) for every socket event, including sizes 0 and 1. Before this PR a size of 1 or less kept the default watermark of 0, and the PR description also says only sizes above 1 change it. With size 1 the event no longer fires for data == 0 readiness (a zero-length datagram, or a write with no free space). Something like |
|
Windows run of
Not run: a title. AI-assisted: yes (Claude Code) |
|
@oneandonlydean right, thanks. Fixed in @ycbuzi thanks for the Windows run and the control. |
ahmadmuj
left a comment
There was a problem hiding this comment.
Reviewed head 84da0e33070c merged onto main 0119103fa9ed (clean merge), Linux x86-64 (WSL2 Ubuntu 24.04, GCC 13.3), Release.
What I ran:
guest_socket_eventson the merge: passes, 20/20 with--repeat until-fail:20.guest_equeue_eventsandguest_kqueuepass too.- Controls with this PR's test: main's
Equeue.cppaborts withsceKernelAddWriteEvent: descriptor that is neither a socket nor a regular file not implemented; the54ffdb28c5assignment (watermark for every size) fails (hangs to the 20 s ctest timeout); an uncheckedstatic_cast<std::int64_t>(size)aborts. So the new checks catch all three.
Two things I think are worth fixing, one minor:
-
Re-adding a socket event keeps the old watermark.
AddDescriptorEventpasses the newlowWatertoKernelEqueuePrivate::AddEvent, but for an event that already exists that only updates deadline, interval and udata (Equeue.cpp:475-477). kevent goes throughModifyKnote, which replaceslowWater(Kqueue.cpp:415), matching the kevent debt entry ("a later change of the knote replaces it askqueue_registerreplaceskn_sdata"). Before this PR the mark was always 0 on this path, so this is new. Probe on the merge, stream socket with 3 bytes queued:sceKernelAddReadEvent(eq, reader, 6, …)thensceKernelAddReadEvent(eq, reader, 1, …): the wait times out (mark is still 6)- size 1 then size 6: the event fires with
data3 (mark is still 1)
Updating
lowWaterfor an existing socket event (asModifyKnotedoes) fixes it, and an add-6-then-add-1 check would cover it. -
Sizes above
INT64_MAXare capped, where kevent throws.DescriptorLowWaterthrows on aNOTE_LOWATmark below 1 (Kqueue.cpp:167), and a size aboveINT64_MAXis exactly such a negative mark if it reacheskn_sdatathe way this PR models it. The kevent measurements entry also records the console firing at once for a mark of -1 on a drained stream socket. So under the PR's own modelsceKernelAddReadEvent(eq, s, SIZE_MAX, …)would fire at once on the console, while here it never fires short of EOF. Throwing for those sizes, as kevent does, fits the throw-on-unknown rule better than picking a behaviour. TheINT64_MAX + 1andSIZE_MAXchecks would then becomeRejects-style or go away. -
Minor: a write event re-added on a pipe after the read end closed returns
EPIPE(Equeue.cpp:836 runs before the existing-event lookup) and keeps the old udata. kevent checksEPIPEonly for a new knote (Kqueue.cpp:475 toAddDescriptorKnote), as FreeBSD 11.4 runspipe_kqfilteronly on attach. Example:sceKernelAddWriteEvent(eq, p[1], 1, a),close(p[0]),sceKernelAddWriteEvent(eq, p[1], 1, b)givesEPIPEhere and success throughkevent. (Read from the code, not run.)
Not run: Windows, macOS.
|
Windows run of the exact head
AI-assisted (Claude Code). |
|
@rocklouis055 xXPBSXx's Windows run above shows |
|
On the Windows failure xXPBSXx reported: the
So Winsock reports the total queued bytes, and 1 when only zero-length datagrams are queued. A peek reports the next datagram's size, the value the Linux and macOS paths give. Peeking for datagram sockets on Windows fixes it. Locally tested, not pushed: #ifdef _WIN32
unsigned long available = 0;
if (ioctlsocket(socket->value, FIONREAD, &available) == 0) *data = static_cast<std::int64_t>(available);
+ if (socket->type == 2 && available != 0) {
+ static thread_local char next[65536];
+ const int size = ::recv(socket->value, next, sizeof(next), MSG_PEEK);
+ if (size >= 0) *data = size;
+ }
#else
The buffer is 64 KiB because, per the Winsock AI-assisted: yes (Claude Code) |
|
Windows run of head
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
@rocklouis055 ycbuzi has traced the Windows data=1 failure to FIONREAD in GuestSockets::Ready and supplied a local before/after probe. The watermark fix can stay; this does not justify changing the zero-datagram expectation to 1. Please reconcile the Windows datagram byte count and rerun the updated socket/equeue tests. If you use MSG_PEEK, keep readiness queries nonblocking when another reader drains the datagram between poll and peek, and cover an empty queue, a zero-length datagram, zero followed by a nonempty datagram, and unchanged stream behavior. The posted local patch and runs are useful evidence, but they are not in the current head yet. |
|
Thanks @xXPBSXx and @wachi35676 for the Windows runs, @ycbuzi for tracing it to Windows datagram size ( The test now covers an empty queue (times out), a zero-length datagram ( @ahmadmuj's points:
Linux, Release: AI-assisted: yes (Claude Code). |
|
@rocklouis055 A Windows run of
I also checked the new peek path's Winsock behaviour on this machine with a standalone probe, built with the same toolchain, that calls
AI-assisted: yes (Claude Code) |
|
@ycbuzi thank you, that settles the open point. I replaced the "not tested" sentence in the Windows datagram debt entry with your measurement in Looking forward to the AI-assisted: yes (Claude Code). |
|
@rocklouis055 The
So on Windows the new datagram case fails without AI-assisted: yes (Claude Code) |
|
@rocklouis055 Thanks for In Could you keep the poll-to-peek path nonblocking through cancellation completion, with a lifetime for the pending |
|
@oneandonlydean @rocklouis055 Some measurements of the cancellation path that may help with the redesign. A standalone probe on this Windows 11 machine (26200, MinGW-w64 GCC 15.2.0) runs the PR's exact sequence: overlapped
The probe source is short; I can attach it if it's useful for the new control. AI-assisted: yes (Claude Code) |
|
@ycbuzi Thanks, that's really useful. The completion-wins race at about 1 in 6 under contention and the wait tail up to 0.72 ms are exactly the cases the new control should cover. Yes, please attach the probe source, so @rocklouis055 can use it as a starting point for the delayed-cancellation and racing-reader control. |
|
@oneandonlydean @rocklouis055 Here's the probe. It's standalone, needs only Winsock, and isn't AnyPS5 code. Build and run: probe.cpp// How long does #10645's peek wait in WSAGetOverlappedResult(..., TRUE) after CancelIoEx, and which way do races go?
// 1. Empty queue: peek, cancel, wait; N times; latency distribution.
// 2. Racing traffic: a sender thread sends small datagrams while another reader thread drains them; the probe thread
// runs the same peek/cancel/wait loop; counts immediate completions, pended-then-completed, pended-then-aborted,
// CancelIoEx failures, and the wait latency.
#include <winsock2.h>
#include <ws2tcpip.h>
#include <algorithm>
#include <atomic>
#include <chrono>
#include <cstdio>
#include <thread>
#include <vector>
struct Outcome {
int immediate = 0, completed = 0, aborted = 0, otherError = 0, cancelFailed = 0;
int cancelFailedNotFound = 0, cancelFailedThenCompleted = 0;
std::vector<double> waitMicros;
};
static void Peek(SOCKET s, Outcome& out) {
static thread_local char next[65536];
WSABUF buffer{sizeof(next), next};
WSAOVERLAPPED overlapped{};
overlapped.hEvent = WSACreateEvent();
DWORD received = 0, flags = MSG_PEEK;
if (WSARecv(s, &buffer, 1, &received, &flags, &overlapped, nullptr) == 0) {
++out.immediate;
} else if (WSAGetLastError() == WSA_IO_PENDING) {
const auto start = std::chrono::steady_clock::now();
const BOOL cancelled = CancelIoEx(reinterpret_cast<HANDLE>(s), &overlapped);
if (!cancelled) { ++out.cancelFailed; if (GetLastError() == ERROR_NOT_FOUND) ++out.cancelFailedNotFound; }
const BOOL ok = WSAGetOverlappedResult(s, &overlapped, &received, TRUE, &flags);
if (!cancelled && ok) ++out.cancelFailedThenCompleted;
const int error = ok ? 0 : WSAGetLastError();
out.waitMicros.push_back(std::chrono::duration<double, std::micro>(std::chrono::steady_clock::now() - start).count());
if (ok) ++out.completed;
else if (error == WSA_OPERATION_ABORTED) ++out.aborted;
else ++out.otherError;
} else {
++out.otherError;
}
WSACloseEvent(overlapped.hEvent);
}
static void Report(const char* label, Outcome& out) {
auto& w = out.waitMicros;
std::sort(w.begin(), w.end());
auto at = [&](double q) { return w.empty() ? 0.0 : w[std::min(w.size() - 1, static_cast<std::size_t>(q * w.size()))]; };
std::printf("%s\n immediate=%d pended+completed=%d pended+aborted(995)=%d other-error=%d CancelIoEx-failed=%d (ERROR_NOT_FOUND %d, then completed %d)\n"
" wait after cancel (us), %zu samples: p50=%.1f p99=%.1f p99.9=%.1f max=%.1f\n",
label, out.immediate, out.completed, out.aborted, out.otherError, out.cancelFailed, out.cancelFailedNotFound, out.cancelFailedThenCompleted, w.size(), at(0.5), at(0.99),
at(0.999), w.empty() ? 0.0 : w.back());
}
int main() {
WSADATA wsa;
WSAStartup(MAKEWORD(2, 2), &wsa);
sockaddr_in addr{};
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
SOCKET target = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
bind(target, reinterpret_cast<sockaddr*>(&addr), sizeof(addr));
sockaddr_in name{};
int length = sizeof(name);
getsockname(target, reinterpret_cast<sockaddr*>(&name), &length);
u_long nonblocking = 1;
ioctlsocket(target, FIONBIO, &nonblocking);
Outcome empty;
for (int i = 0; i < 20000; ++i) Peek(target, empty);
Report("1. empty queue, 20000 peeks (nonblocking socket)", empty);
std::atomic<bool> stop{false};
std::atomic<long> sent{0}, drained{0};
std::thread sender([&] {
SOCKET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
while (!stop.load()) {
if (sendto(s, "abc", 3, 0, reinterpret_cast<sockaddr*>(&name), sizeof(name)) == 3) ++sent;
std::this_thread::yield();
}
closesocket(s);
});
std::thread reader([&] {
char buffer[64];
while (!stop.load()) {
if (recv(target, buffer, sizeof(buffer), 0) >= 0) ++drained;
else std::this_thread::yield();
}
});
Outcome racing;
const auto until = std::chrono::steady_clock::now() + std::chrono::seconds(5);
while (std::chrono::steady_clock::now() < until) Peek(target, racing);
stop = true;
sender.join();
reader.join();
Report("2. 5 s with a sender and a draining reader thread on the same socket", racing);
std::printf(" datagrams sent=%ld drained by the reader=%ld\n", sent.load(), drained.load());
closesocket(target);
WSACleanup();
return 0;
}AI-assisted: yes (Claude Code) |
|
@oneandonlydean you're right, the
I can't force a delayed cancellation from the test, so the racing reader is the control. It shows correct values and no hang, but it can't show that the old code waited. @ycbuzi's probe would show that, and I'm happy to add it as a Windows-only test if it fits. Linux, Release: AI-assisted: yes (Claude Code). |
…ing reset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ncellation - NextDatagramSize checks the cancelled peek with WSAGetOverlappedResult without waiting, so Ready never waits under the equeue mutex. - The OVERLAPPED, event and buffer live in a process-wide pool that is never freed; a peek whose cancellation is still pending is reused only after HasOverlappedIoCompleted reports it done. - A completion that wins over the cancel reports its size; a failed CancelIoEx leaves the peek parked. - Test: a sender and a racing reader on one datagram socket while the read event is polled; every reported size is 0 or 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntil it completes - A peek that WSARecv left pending stays reserved whatever WSAGetOverlappedResult reports, and is reused only once HasOverlappedIoCompleted reports it done. - The pool moves to Socket/include/SubmittedRecords.hpp, and guest_socket_submitted_records checks that a submitted record is not handed out again before completion and is reused after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…est on MinGW - The peek event is created when a pool record is acquired, and a failed WSACreateEvent is tried again on the next acquire instead of leaving the record without an event. - guest_socket_submitted_records checks that a failed preparation is retried and the record then reused. - guest_socket_submitted_record_tests links libc and configures Windows unwinding like guest_socket_event_tests, so it links on MinGW. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l check The racing reader can stop before the sender's last datagram is readable, as on macOS loopback. After both threads join, the test now reads each remaining datagram while the read event reports it, checking its size, and then requires the event to time out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
459808d to
bf70e27
Compare
|
Rebased on macOS racing-reader check (thanks @Gonic0 for the probe, it pointed straight at it): the reader thread could stop before the sender's last datagram became readable, so the final "queue empty" wait found it. After both threads join, the test now reads each late datagram while the read event reports it (checking Rebase: the only conflict was the shared-memory entry next to this PR's entries in Order:
The order is recorded in the description as proposed, not agreed. A macOS rerun on AI-assisted: yes (Claude Code). |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, no blocking findings
The new head changes only the final check after the racing threads join, and I found no blocking defect, but that check no longer fails when a datagram stays queued without an event, which was the symptom the earlier changes-requested review cited.
What I ran
Exact head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9, previously reviewed head 459808d639d933e070dd37115367317657461313, current main e67cc818696fd6e6c58ac80adc6550c54aed68e8 (merge preview clean, no declared dependencies). Environment: Debian 12, Python 3.11.2, git 2.39.5. No build, no compiler, no CTest.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645
python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5
git diff 2742004ed28f765c7147db0e0269ff5868e9eb6f 459808d639d933e070dd37115367317657461313 -- <7 PR files>
git diff ba8dcc6ae82a5c4443efd93bbb99dfa91faf7fa4 bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 -- <7 PR files>
python3 tools/pr_abi_audit.py --repo <local clone> --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json
python3 tools/pr_test_quality.py --root <git archive of the head> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cppThe precheck's ABI and test-quality helpers could not find their scripts in its isolated head tree, so I ran both helpers by hand as listed. The changed-line comparison was run on the PR's own patches at both heads.
Results
| Check | Result |
|---|---|
| Conventions and PR template (precheck) | Passed. |
git diff --check (precheck) |
Passed. |
Live stack and merge preview against main (precheck) |
Clean. |
| Changed lines, old head vs new head | Only one hunk differs: the final check in core/libs/tests/GuestSocketEvents.cpp. The product files (Equeue.cpp, Udp.cpp, SubmittedRecords.hpp, libkernel CMakeLists.txt) have identical changed lines at both heads. |
pr_abi_audit.py (by hand) |
Passed: 58 symbols, 0 findings. |
pr_test_quality.py (by hand) |
Two heuristic findings, both possible-unregistered-cpp-test. Both files are registered in core/libs/prx/libkernel/CMakeLists.txt through ${LIBS_INCLUDE_DIR}/tests/... paths, so these are false positives. |
| Hosted CI (precheck snapshot) | Passed: conventions, library-portability, report, eligibility. Pending: labels, windows. Skipped: linux, register-context, relinker, relinker-asan, write-watch. |
| Build, CTest, macOS | Not run. |
Unedited command output
$ python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head bf70e27f7db6fe20e56d788ee44c0de1c9266ed9 --json
status: passed; symbols: 58; findings: []
$ python3 tools/pr_test_quality.py --root <archive> --json core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp
findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketEvents.cpp, line 1)
findings: possible-unregistered-cpp-test (core/libs/tests/GuestSocketSubmittedRecords.cpp, line 1)
changed-line diff (old head vs new head, PR files only):
< + Require(sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout) == SCE_KERNEL_ERROR_ETIMEDOUT);
> + char late[8];
> + int drained = SCE_OK;
> + while ((drained = sceKernelWaitEqueue(blocking, events.data(), events.size(), &count, &shortTimeout)) == SCE_OK) {
> + Require(count == 1 && (events[0].data == 0 || events[0].data == 3));
> + Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) == events[0].data);
> + }
> + Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT);
Findings
Blocking: None.
Non-blocking:
- At the earlier head, the test asserted a single timeout after the racing threads joined, so any event for a queued datagram failed the test. At the new head, the loop at lines 361-364 drains each event and exits on the first timeout. If a datagram stays queued and no event is reported, the test now passes without checking the queue. The racing reader already relies on a negative
recvwith flag0x80meaning "empty", so an emptiness check can use the same convention. Suggested addition after line 365:
Require(drained == SCE_KERNEL_ERROR_ETIMEDOUT);
Require(recv_nid_postfix(datagram, late, sizeof(late), 0x80) < 0);Sources
- Final drain check at the new head
- Racing reader's
recvloop at the new head - Single-timeout check at the previous head
Not verified
- The Linux repeats the author reports (20 runs of the event suite on the rebuilt tree) and the hosted Linux job, which is skipped on this head, were not run or re-checked here.
- macOS was not run. The rerun on
bf70e27f7db6fe20e56d788ee44c0de1c9266ed9that the description requests is still needed; this review cannot provide it. - The merge order proposed in the PR description is a maintainer decision and is not answered by this review.
…the drain Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@MarcZX10 Good catch. The drain loop alone would pass with a datagram stuck in the queue and no event reported. I added your check in b1d851b: after the final timeout,
AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, changes requested
The new head adds the missing final queue-empty assertion, but the required merge order with three open overlapping PRs is still explicitly unagreed.
What I ran
Reviewed head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1, based on e6f57307fa7f47165d7fc1bee945abdb2f6816e7; the live preview onto current main f2d874c1fdccf781c0fa5d86619bb5dd8894b958 is clean. Environment: Debian 12 x86-64, Python 3.11.2, Git 2.39.5. No compiler or build was run.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 10645
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1
python3 tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/head-b1d851bf4752-41251437 core/libs/prx/libkernel/CMakeLists.txt core/libs/prx/libkernel/Equeue/Equeue.cpp core/libs/prx/libkernel/Socket/include/SubmittedRecords.hpp core/libs/prx/libkernel/Socket/src/Udp.cpp core/libs/tests/GuestSocketEvents.cpp core/libs/tests/GuestSocketSubmittedRecords.cpp docs/dev/debt/libkernel.md
git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1
python3 tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5
git show b1d851bf4752c6cb42f4aba29bc4004fbd666ba1:core/libs/prx/libkernel/CMakeLists.txt | grep -n -A18 'add_test_executable(guest_socket_event_tests'Results
| Check | Result | Note |
|---|---|---|
| Patch and conventions | passed | One existing debt-entry length warning. |
| Export/NID audit | passed | 58 symbols; no findings. |
| Test registration | passed | Both added C++ tests are in CMake. |
| Test-quality heuristic | passed | Two unregistered-test warnings are false positives; CMake uses ${LIBS_INCLUDE_DIR} paths. |
| Current-main merge preview | passed | Clean against current main. |
| Hosted checks | passed | Windows and required metadata checks pass; Linux and specialized jobs were skipped. |
| C++ tests on this head | not run | No exact-head build was performed. |
Selected raw check output
# PR precheck report — checks failed
Head unchanged at completion: **True**
Base unchanged at completion: **True**
| Check | Status | Command / reason |
|---|---|---|
| diff_check | passed | `git diff --check e6f57307fa7f47165d7fc1bee945abdb2f6816e7...b1d851bf4752c6cb42f4aba29bc4004fbd666ba1` |
| conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base e6f57307fa7f47165d7fc1bee945abdb2f6816e7 --head b1d851bf4752c6cb42f4aba29bc4004fbd666ba1 --title feat(libkernel): add pipe write events and socket low watermarks to sceKernelAdd*Event --body /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/pr-body.md` |
| changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py ...`; script absent from detached snapshot |
| live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 10645 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-10645-b1d851bf4752/stack` |
| test_quality_heuristics | failed | Script absent from detached snapshot |
Manual rerun:
ABI audit: passed
core/libs/tests/GuestSocketEvents.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
core/libs/tests/GuestSocketSubmittedRecords.cpp:1: possible-unregistered-cpp-test: Changed C++ test source path was not found literally in CMake files; inspect registration, generated source lists, and workflow coverage.
Heuristic findings require manual interpretation.
Target branch tip: `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`
All heads unchanged: **True**
Dependency order: #10645
- PR #10645: **clean** against current base; head `b1d851bf4752c6cb42f4aba29bc4004fbd666ba1`
No declared PR dependencies were found in the target PR chain.
Negative control
| Assertion | Code change | Result |
|---|---|---|
| The datagram queue is empty after the final equeue timeout. | Author reports sending an extra datagram before the assertion. | Author reports the test fails; I did not independently run this control. |
Findings
Blocking
- The PR proposes landing before #12682, #12688 and #12700, but says this order is “Not yet agreed.” Those PRs remain open, and the transport PR records an overlapping
Udp.cppseam with #10645 and says the second PR must rebase. The repository requires overlapping authors to agree on order and declare it withDepends on. Please coordinate the order with the affected authors and update the PR order/dependency declaration to reflect that agreement.
Non-blocking
- The reported macOS rerun is still outstanding on this head. The earlier macOS failure was reported against an older head; Windows CI passes, but this does not verify the macOS case.
Sources
- Contribution rule at current main
- Final queue assertion at this head
- CMake registration at this head
- Transport PR overlap comment
- Author-reported Linux negative control
Not verified
No local build, CTest, macOS rerun, or console behavior was verified. The negative control is author-reported only.
To get this to a good state
Please reach and record an order agreement with the overlapping PR authors, then update the relevant Depends on declarations. I will rerun the same no-build checks on the new head.
|
On the open merge-order point in MarcZX10's last review: on current I tested that combination locally (nothing pushed):
So either landing order costs one AI-assisted: yes (Claude Code) |
|
@B-Howell thank you for composing and running the stack on both hosts, and for the Windows run of @Felipebmaitan on the landing order: I'm sorry I never answered your proposal from Oct 27. It was for #11969, which has since closed, and your stack is now #12682 → #12688 → #12700. As B-Howell showed, and as your audits on #12688 and #12700 say, the only overlap is the adjacent I propose #10645 first, then your stack, which keeps both includes when it next rebases. #10645 has no open prerequisites and merges cleanly with AI-assisted: yes (Claude Code) |
|
macOS run of Tree:
Targeted: the 22 existing socket, equeue, kqueue, udp and pipe tests plus
Negative control (this PR's two test files and their CMake lines on the same base, no source changes):
Full
Not tested: Linux, Windows, and pipe write events on macOS. AI-assisted: yes |
|
@tkcm01 thank you for the macOS run, and for running the negative control and checking the full suite before and after. @Felipebmaitan a gentle ping on the order question above: #10645 first and then your stack, or your stack first and I declare AI-assisted: yes (Claude Code) |
|
@oneandonlydean could you check where this one stands? The head Is anything still missing here, or can it be merged? AI-assisted: yes (Claude Code) |
|
Fresh overlap audit against the current heads (source-only; no combined build in this pass):
So whichever lands second must deliberately preserve both behaviors. If #12700 lands first, #10645's rebase needs to re-add the submitted-record peek helper and the Ready datagram-size correction. If #10645 lands first, the #12682 -> #12688 -> #12700 rebase needs to carry those pieces forward. Given #10645 is independently clean and already has Linux/Windows/macOS validation, #10645 first remains the simpler landing order; the transport stack can then rebase once and preserve the three pieces above. This does not by itself resolve MarcZX10's formal order blocker: it still needs the owners/maintainer to agree on that order and the composed head to be re-tested. @Felipebmaitan @MarcZX10 @oneandonlydean AI-assisted: yes |
10645 dismiss MarcZX10 CR 5729042250 (1 Nov, on b1d851b = live head)
CR: merge order with the #12682 -> #12688 -> #12700 stack not agreed.
Settled: B-Howell 2 Nov tested main + #12700 stack + this head on Linux and Windows, both includes kept: the 7 socket/equeue tests pass 3/3. malekaifa 23 Nov audit: #10645 first is the simpler order; whichever lands second must keep SubmittedRecords peek + Ready datagram-size correction. Today #12682, #12688, #12700 are all CONFLICTING with main while #10645 is MERGEABLE, so #10645 lands first and the stack's rebase carries both behaviours (noted for that stack's reviewers).
Fresh PASS HIGH NO by pr-review1 on b1d851b 26 Nov (notes/10645-b1d851bf47.md, key claims verified at Equeue.cpp:892-914).
What
Builds on #9099 (@aarushkha's regular-file events, merged). It extends
sceKernelAddReadEventandsceKernelAddWriteEventwith the two caseskeventalready handles and these still throw on:Write end of a pipe:
sceKernelAddWriteEventtakes it throughGuestSockets::PipeWriteState, withEV_EOFonce the read end closes andSCE_KERNEL_ERROR_EPIPEfor a new event added after that, asAddDescriptorKnoteinKqueue.cppdoes; adding an existing one again succeeds and replaces itsudata, askeventdoes. A read event on the write end and a write event on the read end still throw, as inkevent.Socket low watermark: a
sizeabove 1 on a stream socket becomes the event'slowWater, asNOTE_LOWATdoes inkevent(DescriptorLowWater); above 1 on a socket that is not a stream throws, as there. Adding the event again replaces the mark, asModifyKnotedoes, and a size aboveINT64_MAX, which askn_sdatawould be a mark below 1, throws asDescriptorLowWaterdoes. The size stays ignored on pipes, as inkevent, and a size above 1 on a regular file keeps feat(libkernel): answer sceKernelAddReadEvent and sceKernelAddWriteEvent on regular files #9099's throw.Datagram size on Windows:
GuestSockets::Readyreads a datagram socket'sdatafrom an overlappedMSG_PEEKreceive, cancelled without waiting if it would pend (itsOVERLAPPED, event and buffer stay in a never-freed pool until the kernel completes it), so it reports the next datagram's size as Linux and macOS do; Winsock'sFIONREADreports 1 for a zero-length datagram (traced by @ycbuzi).The debt entries for these calls are updated: the pipe entry now covers both ends, the socket entry states the low watermark (still above the 1000-character warning it already triggers on
main), and a new entry covers the Windows datagram size.#9823 also edits these lines, replacing
NotImplemented_nid_no_patchwiththrow; it does not add either case.Order with overlapping PRs
#12296 has merged. The remaining overlap is with @Felipebmaitan's #12682 → #12688 → #12700 stack: both sides add an
#includeat the same place inSocket/src/Udp.cpp, and nothing else conflicts or calls the other side's code (composed and run on Linux and Windows by @B-Howell). Proposed: this PR first, then that stack, keeping both includes; if its author prefers the reverse, this PR will declareDepends on: #12700and rebase. Asked here; not yet agreed.Tested
Linux x86-64 (Ubuntu 26.04, GCC 15), Release, on
bf70e27f7d(rebased onmainba8dcc6ae8).guest_socket_eventscovers: a pipe write event withEV_EOF,EPIPEfor a new event after the read end closed and a successful re-add with newudata; stream read marks of 6 andINT64_MAXthat time out at 3 bytes, a re-add fromINT64_MAXto 1 that fires withdata3 and from 1 to 6 that times out again; a write mark of 64; and a connected loopback datagram socket with an empty queue (times out), a zero-length datagram (data0), and a zero-length then a 3-byte datagram (data0, then 3), and a sender and a racing reader on that socket while the read event is polled (everydata0 or 3, then each late datagram read until the event times out).guest_socket_submitted_recordschecks the peek pool: a submitted record is not handed out again before completion and is reused after it, and a failed event creation is retried on the next acquire. It,guest_equeue_events,guest_kqueueandguest_udppass 20 times withctest --repeat until-fail:20. Reverting the re-add mark update, or returningEPIPEon every re-add, makesguest_socket_eventsabort. The WindowsUdp.cpppasses a syntax check with clang forx86_64-windows-gnu(no diagnostics in the new code), and @ycbuzi ran8e19a7affcon Windows (the four tests pass; with onlymain'sUdp.cppthe zero-length datagram check fails), and @B-Howell ranb1d851bf47on Windows 11 and WSL2 (the seven socket and event tests pass 3 of 3; withmain'sEqueue.cppandUdp.cpp,guest_socket_eventsaborts); @tkcm01 ranb1d851bf47on macOS (Apple M4, x86_64 under Rosetta 2):guest_socket_eventspasses 30/30 andguest_socket_submitted_records5/5, and with only this PR's testsguest_socket_eventsaborts on the missing low watermark. The pipe write-event cases are skipped there, since the pipe write state throws on macOS, as forkevent.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code