libSceNet Sockets implementation issue #2811
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T15:51:48Z.
Title:libSceNet Sockets implementation (Dungeons, PPSA16064)
Environment
5edae35361>Game
What happens
The conversion succeeds and the game starts. It creates a window and a swapchain (1536x864) and begins creating render targets. After that it aborts with:
The crashing thread has no named stack in the dump, so I can't tell which game code calls
select().The last file the game opened before the crash was
/dev/urandom. I don't know whether this is related.Time before the crash: . What I saw on screen: .
Progress since an earlier version
On my previous commit, the game aborted earlier with:
After updating, these shaders are reported as
could not be prepared at registration ... preparing it when it is used, and the game gets further. This new abort is a different problem.Key lines:
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T16:12:43Z.
Test 2 using a new relinker version (realized that I used the old one). The same issue is reproducable even with the latest relinker version.
What happens :
Reproduced in two separate runs. Both crash with identical offsets:
libc.prx+0xa267, libc.prx+0x83599, and the exception is thrown from libc.prx+0x4d316.
The crashing thread is not included in the thread dump (14 threads omitted).
&
what(): select on descriptors that are not libSceNet sockets not implemented
FATAL: abort() (SIGABRT) on thread 23964
#0 libc.prx+0xa267
#1 libc.prx+0x83599
What I can add is that the frames are definitely higher than the past commit I used, getting 50 fps on the Xbox Game Studios logo rather than 5-6 fps on the old commit.
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T17:24:09Z.
@MisterbALLIN I think the
/dev/urandomopen you spotted is the cause, and I have a branch for you to try:Silverash-i8/AnyPS5-fork:fix/select-random-device, one commit45c387fdonmain57f96fd2.Why I think so:
select(libkernel/Socket/src/Socket.cpp) hands every descriptor it gets to the libSceNet socket poller and aborts on any descriptor the poller doesn't know. libkernel's own sockets start at0x10000000, so they can't be in a 1024-bitfd_setat all. What's left below 1024 that isn't a libSceNet socket is mostly files, and/dev/urandomis opened as a host descriptor (File::OpenRandomDevice). On FreeBSD the random device always polls as readable once it's seeded, so code that selects on it before reading just expects an immediate answer.The fix answers random device descriptors in
selectwithout asking the poller: readable and writable are reported ready, and if one is ready the socket part of the same call doesn't wait. Everything else goes through the poller exactly as before, so a descriptor that really is something else (a pipe, say) still stops with the same message.Tested on Windows 11, WinLibs GCC 15.2.0 r7, Release:
guest_sce_net:selectwith no timeout on an open/dev/urandomplus an idle UDP socket. Onmainit aborts withselect on descriptors that are not libSceNet sockets not implemented, the same line as your log. With the fix it returns 1 straight away, with only the urandom bit left set.ctest -R "guest_|kernel|libc|net": 234/234 pass.tools/check_conventions.pypasses.I don't have Dungeons, so I can't confirm it gets the game further. If you get a chance to run it with this branch, I'd love to know whether it gets past this point. If it still stops with the same message, the descriptor is something other than urandom, and I'll take another look.
AI-assisted (Claude Code); I ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T19:34:51Z.
Tried the given fork and the same issue (libSceNet sockets) that Claude pointed out comes up. /dev/urandom is still present
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T19:55:47Z.
@MisterbALLIN thanks for trying it. So the descriptor isn't the urandom one after all, and my guess was wrong.
The old message doesn't say which descriptor it was, so I pushed one more commit to the same branch,
61eac72fonfix/select-random-device. It changes only the abort text, which now reads likeor
(libSceNet is not loaded)if libSceNet never registered its socket poller. Could you run Dungeons once more with this build and paste that line? The number tells us what kind of descriptor it is: below 3 is stdin/stdout/stderr, a small number that isn't a socket is a file or pipe from the title's ownopen/pipe, and the libSceNet case would mean the game never loaded the networking module. With that I can write the actual fix.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T20:17:13Z.
I am so dumb, I was on main instead of the fix branch TvT. Will be retrying the fix right away.
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T20:28:15Z.
This is the new message I get after trying out your branch :
what(): select on descriptor 0 (not a libSceNet socket) not implemented
FATAL: abort() (SIGABRT) on thread 1468
#0 libc.prx+0xa267
#1 libc.prx+0x83599
It points to a descriptor now, this being descriptor 0
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T20:32:13Z.
@MisterbALLIN no worries, and thanks for running it again. Descriptor 0 is stdin. UE4 polls stdin with
selectto pick up console commands, and a console title has no input there.New commit on the same branch:
2bfaa331onfix/select-random-device.selectnow answers descriptor 0 as never readable and descriptors 1 and 2 (stdout, stderr) as always writable. Anything else that isn't a libSceNet socket still stops with the message from the last commit, so if Dungeons waits on something else next you'll see its number. I added the assumption todocs/dev/TechnicalDebt.md, next to the existing entry for what descriptors 0 to 2 are on a console.Tested on Windows 11, WinLibs GCC 15.2.0 r7: I added a stdin/stdout case to
guest_sce_net, which on the previous commit stops with exactly your line,select on descriptor 0 (not a libSceNet socket) not implemented, and passes now.ctest -R "guest_|kernel|libc|net"is 234/234 andtools/check_conventions.pypasses.Could you give it one more run and say how far it gets?
AI-assisted (Claude Code); I ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MisterbALLIN on 2026-10-10T21:16:10Z.
The game launches and renders the background menu and animations before crashing. It does through a RecompileRequest which I have linked to with a txt file.
According to Claude,
PS5 shaders can run in groups of 64 threads (“wave64”). Your RTX 4060 runs groups of 32, and your log says so: subgroup=32.
v_readlane_b32 reads a value from one specific thread in the group. This shader asks for thread 63. The host group only has threads 0 to 31, so the recompiler can’t translate it.
The project throws an exception and nothing catches it. That is the same pattern as the first s_swappc_b64 error: the shader is reported as “could not be prepared” and then the program aborts.
A second shader fails the same way. The log shows hash=0x110596354048 with the same reason. The two messages are interleaved in the output, so the second one is cut up.
I can’t tell what the shader does. stage=1 and the hash don’t say. I’d only be guessing.
Log file linked and recompile request file too
log.txt
request1.txt
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T21:18:01Z.
@MisterbALLIN that's great, so the
selectfix got it to the menu. Thanks for the request file, it made this easy to pin down.This new stop is #2783. I ran your
request1.txtthroughagc_shader_replay --asm, and it's the same Unreal Engine culling vertex program that Taxi Chaos 2 hits there, instruction for instruction at the same offsets:v_cndmaskat 0x77c, the DPP OR scan from 0x794,v_permlanex16at 0x7d4, thenv_readlaneof lanes 31 and 63 at 0x7ec and 0x7f4, joined bys_or_b32at 0x80c. Your second hash (0x110596354048) has the same reason, so it's very likely the same program again.The shader is written for 64-lane waves, and NVIDIA (and Intel) GPUs run 32-lane subgroups, so lane 63 doesn't exist on the host. How to translate it is the open question on #2783, waiting on the maintainers, so there's no small fix I can hand you for this one.
The one thing that might get you past it today: if your laptop also has an AMD Radeon integrated GPU, try launching with
ANYPS5_GPU=AMD. The #2783 reporter got past this shader that way on a Radeon 880M, since AMD runs 64-lane subgroups. On an Intel iGPU it will stop the same way.I'll add Dungeons to #2783 as a second title with this program.
AI-assisted (Claude Code); I ran the disassembly above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T10:32:48Z.
A second title with this stop: RIDE 4 (PPSA01599, Unreal Engine 4) on Linux.
On main it aborts a few seconds in, right after OpenSSL opens
/dev/urandom, with the same line:I tested the same approach as @Silverash-i8's
2bfaa331, written independently on my side:With it RIDE 4 gets past the stop, and nothing else ever reached the throw, so its descriptor was one of 0-2 (UE4's stdin poll, as for Dungeons). Its later stops are unrelated (#3435, and #2548).
@Silverash-i8, would you open your branch as a PR? It now has two titles behind it. I'd rather not open a competing one.
AI-assisted (Claude Code); I ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T10:39:52Z.
@alfalfa-star thanks for the RIDE 4 run, and for writing it independently, that's a good cross-check. I'd open it as a PR if I could, but I'm under the intake limit (fewer than 10 merged PRs of my own), so the bot would close it straight away. My other fixes have gone in when someone eligible carried the commits.
To make that easy, I've put the three commits on a fresh branch on current
main99c1c263, unchanged apart from the rebase (it applied without conflicts):fix/select-non-socket-descriptors259b9ca6random-device descriptors (/dev/random,/dev/urandom) report readya670e93aa descriptorselectcan't poll still throws, now naming it2ba139dfdescriptor 0 is never readable, 1 and 2 are always writableRechecked on Windows 11, WinLibs GCC 15.2.0 r7, Release:
guest_sce_net(with cases for the random-device and standard-descriptor answers) and the socket tests pass, the non-GPU suite is 457/458 (the one failure iswindows_exceptions, which fails the same way onmain, #3411), andtools/check_conventions.py --base upstream/mainpasses.Behind it now: Minecraft Dungeons II (MisterbALLIN, earlier in this thread) and RIDE 4 (your run). If you or anyone eligible can carry it, please keep the commits as they are.
AI-assisted (Claude Code); I ran the above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T11:13:08Z.
@Silverash-i8 carried as #3476, your three commits unchanged with your authorship. I reviewed them,
guest_sce_netfails onmainand passes with them, fullctestis 825/825 on Linux, and RIDE 4 on currentmainplus only these commits gets past the stop to the logo and legal screen.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T11:30:00Z.
Thanks @YossiYad and @alfalfa-star, it turns out you both carried these commits: #3455 and #3476 are the same three commits (identical
git patch-idover the whole diff, just rebased onto differentmaincommits). Only one of them needs reviewing. #3455 came first and already saysCloses #2811, so it would make sense to keep that one, but I'll leave it to you two and the maintainers.On #3462 (exefer), which overlaps both: it host-polls descriptors below
GuestSockets::FirstDescriptorwithpoll(), but only on Linux. On Windows itsselectstill throws for every descriptor that isn't a socket (#ifdef _WIN32 NotImplemented_nid_no_patch(...)), so on its own it wouldn't get Minecraft Dungeons II past descriptor 0 on Windows, where MisterbALLIN hit it. As exefer says in that PR, the two fit together: answer the standard and random-device descriptors first, then host-poll the rest on Linux.AI-assisted (Claude Code); I compared the PR heads on my machine.