[GH-ISSUE #590] P5D enters weird softlock state while exploring menus due to thread management(?) #136

Closed
opened 2026-02-27 21:04:46 +03:00 by kerem · 20 comments
Owner

Originally created by @Da-nu on GitHub (Aug 26, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/590

heres what I found notable in the logs
[Kernel.Pthread] <Info> thread_management.cpp:scePthreadAttrSetaffinity:295: called
[Kernel.Pthread] <Info> thread_management.cpp:scePthreadCreate:1040: thread create name = UNLOCK Thread
[Core.Linker] <Error> linker.cpp:InitTlsForThread:346: TLS user malloc called, using std::malloc
[Core] <Error> stubs.cpp:CommonStub:42: Stub: sceRazorCpuFiberSwitch (nid: PAytDtFGpqY) called, returning zero to 0x91fffd896
[Lib.UserService] <Info> userservice.cpp:sceUserServiceGetInitialUser:492: called
[Core] <Error> stubs.cpp:CommonStub:42: Stub: sceRazorCpuFiberSwitch (nid: PAytDtFGpqY) called, returning zero to 0x91fffd896
[Kernel.Pthread] <Info> thread_management.cpp:scePthreadJoin:1113: scePthreadJoin result = 0

here is my latest shad_log.txt
shad_log.txt

UPDATE: issue is probably due to thread management and not TLS. I am already aware someone is working on a rewrite for thread management and will wait for that to release.

Originally created by @Da-nu on GitHub (Aug 26, 2024). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/590 heres what I found notable in the logs `[Kernel.Pthread] <Info> thread_management.cpp:scePthreadAttrSetaffinity:295: called` `[Kernel.Pthread] <Info> thread_management.cpp:scePthreadCreate:1040: thread create name = UNLOCK Thread` `[Core.Linker] <Error> linker.cpp:InitTlsForThread:346: TLS user malloc called, using std::malloc` `[Core] <Error> stubs.cpp:CommonStub:42: Stub: sceRazorCpuFiberSwitch (nid: PAytDtFGpqY) called, returning zero to 0x91fffd896` `[Lib.UserService] <Info> userservice.cpp:sceUserServiceGetInitialUser:492: called` `[Core] <Error> stubs.cpp:CommonStub:42: Stub: sceRazorCpuFiberSwitch (nid: PAytDtFGpqY) called, returning zero to 0x91fffd896` `[Kernel.Pthread] <Info> thread_management.cpp:scePthreadJoin:1113: scePthreadJoin result = 0` here is my latest shad_log.txt [shad_log.txt](https://github.com/user-attachments/files/16743051/shad_log.txt) UPDATE: issue is probably due to thread management and not TLS. I am already aware someone is working on a rewrite for thread management and will wait for that to release.
kerem closed this issue 2026-02-27 21:04:47 +03:00
Author
Owner

@Hermiten commented on GitHub (Sep 4, 2024):

So nice, everything on the same line !
Can be close ? This is not really usefull and I think no developer pays attention to this kind of issue

<!-- gh-comment-id:2328258893 --> @Hermiten commented on GitHub (Sep 4, 2024): So nice, everything on the same line ! Can be close ? This is not really usefull and I think no developer pays attention to this kind of issue
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

I tried to put it in new lines but github refused to let me do so

<!-- gh-comment-id:2329043410 --> @Da-nu commented on GitHub (Sep 4, 2024): I tried to put it in new lines but github refused to let me do so
Author
Owner

@polybiusproxy commented on GitHub (Sep 4, 2024):

@Da-nu Do you have these sceRazorCpuFiberSwitch stubs on every frame?
Try adding libSceRazorCpu to the sys_modules too.

<!-- gh-comment-id:2329071705 --> @polybiusproxy commented on GitHub (Sep 4, 2024): @Da-nu Do you have these `sceRazorCpuFiberSwitch` stubs on every frame? Try adding `libSceRazorCpu` to the sys_modules too.
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

Yes it is every frame, adding libSceRazorCpu did nothing

<!-- gh-comment-id:2329079708 --> @Da-nu commented on GitHub (Sep 4, 2024): Yes it is every frame, adding libSceRazorCpu did nothing
Author
Owner

@polybiusproxy commented on GitHub (Sep 4, 2024):

Yes it is every frame, adding libSceRazorCpu did nothing

I forgot to mention that you have to modify the source of the emulator to make it load the LLE module: https://github.com/shadps4-emu/shadPS4/blob/main/src/emulator.cpp#L198-L208

<!-- gh-comment-id:2329084021 --> @polybiusproxy commented on GitHub (Sep 4, 2024): > Yes it is every frame, adding libSceRazorCpu did nothing I forgot to mention that you have to modify the source of the emulator to make it load the LLE module: https://github.com/shadps4-emu/shadPS4/blob/main/src/emulator.cpp#L198-L208
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

haven't tried compiling it before, will see if i can figure it out when I get home

<!-- gh-comment-id:2329088937 --> @Da-nu commented on GitHub (Sep 4, 2024): haven't tried compiling it before, will see if i can figure it out when I get home
Author
Owner

@StevenMiller123 commented on GitHub (Sep 4, 2024):

@Da-nu You can avoid that by adding the module to the game's sys_modules folder instead. Just remember to remove it when you're done testing.

<!-- gh-comment-id:2329098206 --> @StevenMiller123 commented on GitHub (Sep 4, 2024): @Da-nu You can avoid that by adding the module to the game's sys_modules folder instead. Just remember to remove it when you're done testing.
Author
Owner

@StevenMiller123 commented on GitHub (Sep 4, 2024):

As a side note, I've seen soft lock issues in other games using libSceFiber as well (mainly the Kingdom Hearts series). Could there be issues related to using LLE Fiber?

<!-- gh-comment-id:2329112225 --> @StevenMiller123 commented on GitHub (Sep 4, 2024): As a side note, I've seen soft lock issues in other games using libSceFiber as well (mainly the Kingdom Hearts series). Could there be issues related to using LLE Fiber?
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

Do the KH games also enter a state where it just stops loading new things alongside it? with P5D whatever part of the menu im in still functions, but when it tries to transition to a new part of the menu it just softlocks. It also stops loading any new assets or models that the current menu calls for when it happens.

<!-- gh-comment-id:2329122945 --> @Da-nu commented on GitHub (Sep 4, 2024): Do the KH games also enter a state where it just stops loading new things alongside it? with P5D whatever part of the menu im in still functions, but when it tries to transition to a new part of the menu it just softlocks. It also stops loading any new assets or models that the current menu calls for when it happens.
Author
Owner

@StevenMiller123 commented on GitHub (Sep 4, 2024):

Talking to NPCs occasionally caused softlocks like that, where everything still rendered normally, but the game itself was not responding to any controls and the NPC's dialog never showed. Most of the softlocks occurred when changing areas or loading cutscenes though.

<!-- gh-comment-id:2329137388 --> @StevenMiller123 commented on GitHub (Sep 4, 2024): Talking to NPCs occasionally caused softlocks like that, where everything still rendered normally, but the game itself was not responding to any controls and the NPC's dialog never showed. Most of the softlocks occurred when changing areas or loading cutscenes though.
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

Huh, so it does sort of act like how P5D does. The different parts of the menu are essentially different areas in P5D.

<!-- gh-comment-id:2329141912 --> @Da-nu commented on GitHub (Sep 4, 2024): Huh, so it does sort of act like how P5D does. The different parts of the menu are essentially different areas in P5D.
Author
Owner

@Da-nu commented on GitHub (Sep 4, 2024):

I originally said it was "due to TLS user malloc" because thats what I see show up in the logs each time this softlock state occurs

<!-- gh-comment-id:2329144917 --> @Da-nu commented on GitHub (Sep 4, 2024): I originally said it was "due to TLS user malloc" because thats what I see show up in the logs each time this softlock state occurs
Author
Owner

@StevenMiller123 commented on GitHub (Sep 4, 2024):

I don't think the TLS user malloc is related, but I know the Dragon Ball Xenoverse games started deadlocking on sceAudioOutOpen when the TLS user malloc thing was implemented, just waiting a minute or so resolves that issue though. My point is, I'd expect it to be completely unresponsive if it were the TLS user malloc.

<!-- gh-comment-id:2329150045 --> @StevenMiller123 commented on GitHub (Sep 4, 2024): I don't think the TLS user malloc is related, but I know the Dragon Ball Xenoverse games started deadlocking on sceAudioOutOpen when the TLS user malloc thing was implemented, just waiting a minute or so resolves that issue though. My point is, I'd expect it to be completely unresponsive if it were the TLS user malloc.
Author
Owner

@StevenMiller123 commented on GitHub (Sep 4, 2024):

@polybiusproxy As a heads up, the RazorCpu spam occurs in all games using libSceFiber. It usually doesn't seem to cause issues, and the issues I've seen in games aren't resolved by adding libSceRazorCpu LLE.

<!-- gh-comment-id:2329158942 --> @StevenMiller123 commented on GitHub (Sep 4, 2024): @polybiusproxy As a heads up, the RazorCpu spam occurs in all games using libSceFiber. It usually doesn't seem to cause issues, and the issues I've seen in games aren't resolved by adding libSceRazorCpu LLE.
Author
Owner

@polybiusproxy commented on GitHub (Sep 4, 2024):

@polybiusproxy As a heads up, the RazorCpu spam occurs in all games using libSceFiber. It usually doesn't seem to cause issues, and the issues I've seen in games aren't resolved by adding libSceRazorCpu LLE.

Ah, that makes more sense.

<!-- gh-comment-id:2329320243 --> @polybiusproxy commented on GitHub (Sep 4, 2024): > @polybiusproxy As a heads up, the RazorCpu spam occurs in all games using libSceFiber. It usually doesn't seem to cause issues, and the issues I've seen in games aren't resolved by adding libSceRazorCpu LLE. Ah, that makes more sense.
Author
Owner

@Da-nu commented on GitHub (Sep 27, 2024):

I don't think the TLS user malloc is related, but I know the Dragon Ball Xenoverse games started deadlocking on sceAudioOutOpen when the TLS user malloc thing was implemented, just waiting a minute or so resolves that issue though. My point is, I'd expect it to be completely unresponsive if it were the TLS user malloc.

sorry if im necrobumping, but what if its related to thread management itself?
[Kernel.Pthread] <Info> thread_management.cpp:scePthreadJoin:1111: scePthreadJoin result = 0

<!-- gh-comment-id:2378218108 --> @Da-nu commented on GitHub (Sep 27, 2024): > I don't think the TLS user malloc is related, but I know the Dragon Ball Xenoverse games started deadlocking on sceAudioOutOpen when the TLS user malloc thing was implemented, just waiting a minute or so resolves that issue though. My point is, I'd expect it to be completely unresponsive if it were the TLS user malloc. sorry if im necrobumping, but what if its related to thread management itself? `[Kernel.Pthread] <Info> thread_management.cpp:scePthreadJoin:1111: scePthreadJoin result = 0`
Author
Owner

@StevenMiller123 commented on GitHub (Sep 27, 2024):

I mean, most issues at this point are related to thread management. The thread management code is rather messy, to the point where one of the devs is working on a complete rewrite of that stuff.

<!-- gh-comment-id:2378229911 --> @StevenMiller123 commented on GitHub (Sep 27, 2024): I mean, most issues at this point are related to thread management. The thread management code is rather messy, to the point where one of the devs is working on a complete rewrite of that stuff.
Author
Owner

@Da-nu commented on GitHub (Sep 27, 2024):

at this point its the only explanation to the game's weird softlock behavior.
All we can do now is wait.

<!-- gh-comment-id:2378232336 --> @Da-nu commented on GitHub (Sep 27, 2024): at this point its the only explanation to the game's weird softlock behavior. All we can do now is wait.
Author
Owner

@Da-nu commented on GitHub (Oct 14, 2024):

Completed? As far as I am aware the game still softlocks?

<!-- gh-comment-id:2411376767 --> @Da-nu commented on GitHub (Oct 14, 2024): Completed? As far as I am aware the game still softlocks?
Author
Owner

@Hermiten commented on GitHub (Oct 14, 2024):

We will follow on your new issue. Thanks you

<!-- gh-comment-id:2411462797 --> @Hermiten commented on GitHub (Oct 14, 2024): We will follow on your new issue. Thanks you
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#136
No description provided.