-
Notifications
You must be signed in to change notification settings - Fork 18
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
Zombies ate my 3DS? (kernel panic after multiple 3dsx app exits) #48
Comments
Hmm. Are we sure the threads are deallocated properly? Especially those on the system core. We should check for that and see what we get. |
I did some testing and I only see this happening when Note that we're currently using this system call as part of We have a few options:
|
I opened rust3ds/pthread-3ds#12 to avoid calling |
Is this issue closed? I couldn’t replicate it myself, though it seems like you fixed it(?). Tell me if anything is needed. |
I think it's still an issue for the APIs that call Here's an idea: what if instead of using // pthread-3ds
struct PThread {
ctru_thread: ctru_sys::Thread,
thread_id: u32, // or whatever type this needs to be, I think it's u32
}
// libc
pub type pthread_t = *mut ::c_void; // really a *mut PThread I think then we could use There would be a little bit of extra memory management and bookkeeping, but not too much different than what we already have. Let me know what you think, I'm fairly sure this would work and could avoid some of these issues. I will try to get a proof of concept working when I have time as well. Side note: I've noticed that the result of |
I was writing a comment but forgot to finish it. I haven't read @ian-h-chamberlain's comment fully yet, but the issue isn't currently fixed because the thread list function is still used by |
@ian-h-chamberlain That sounds like a good solution, do you want to make a PR? Edit: not sure if we need to change libc. Check what the other platforms do. I think as long as the ABI is the same between long and *void it's fine. But feel free to make the change since it's technically more accurate. |
@Meziu @ian-h-chamberlain let me know also if you're having trouble reproducing the issue. It should definitely reproduce if you call You should be able to open Luma3DS's menu and look at the process list, and at the bottom see some 3dsx_app processes marked as Zombie. |
Looks like it varies by platform, some use various int type,s, some use I'll open a PR based on what I have now, although it's unfortunate that any example using |
The thread list syscall has a bug which causes the process to become a zombie. See #48.
Yeah, I've been scouring the internet looking for anything else that references the issue, but I haven't found anything. Luckily only thread-info uses it explicitly, and I've just pushed a change to remove that usage. |
Fun title aside, some odd things happen if you run a 3dsx program a bunch of times. When exiting the 5th run, I get an ARM exception: prefetch abort (kernel panic). This might be related to the std threads, or it's always been there, but it's pretty weird.
The "Fault status" is "Debug event" and it's an exception on core 1 (sys core, which makes sense since the error says kernel panic).
I noticed in Luma3DS's process list that there's zombie 3dsx_app processes when you open/close a program a few times. It panics when there are 4 zombies and you close the 5th 3dsx_app process.
The program I can definitely reproduce this with is thread-info in #46, but I also get it when running the ctru-rs tests (also under std threads though). I haven't tried testing more programs yet, or without std threads.
The text was updated successfully, but these errors were encountered: