-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Difficult to identify specific threads when tracking down issues #6527
Comments
You can use ThreadManager to inspect threads created directly by the main thread, which include lots of useful functions to do what you want. Assuming that the thread you're looking for was started directly by the main thread, anyway. |
No, this doesn't work on individual threads. pmmpthread could introduce a method to set thread name, but platforms like MacOS only allow a thread to change its own name, so it's a bit annoying to implement. |
Relates to pmmp/ext-pmmpthread#139 |
Isn't @cli_set_process_title already used in PM by Console reader? |
I've seen it after my issue, it seems like I'm unable to get a PID from it (currentThreadId seems a long 64bit id), and, weirdly the getcurrentthread returns null for each threads in the ThreadManager. |
ConsoleReader isn't a thread
Thread::getCurrentThreadId() returns the ID of the currently executing thread. It's static for a reason. You should use this function: https://github.com/pmmp/ext-pmmpthread/blob/71cae13851a2ee9cc8558d6e5d0faf8c5bedb36d/stubs/Thread.stub.php#L159 |
Yes that's my bad I didn't saw it was static, but that's what I was saying, it returns very long ID that I don't really know what they stands for:
|
After doing some digging it looks like pthread_self() isn't the same as the ID shown by htop. Still, this shouldn't be necessary anyway. What's needed is to implement pmmp/ext-pmmpthread#139. |
Problem description
I'm having trouble debugging who's using 10MBps, I've narrowed down to a SPID (thread pid) but I'm unable to do anything with it because there's no way to know which threads it corresponds in PM.
Proposed solution
As already asked, yes there's issues with the fact that there's no cross platform way (according to Dylan, though @cli_set_process_title may be an answer ?). I think at least there should be a way to get an instance of every threads used in pocketmine through a plugin so we can dump IDs with this. Or even better an in-game Pocketmine command to dump every process ids for admins.
Alternative solutions that don't require API changes
Doesn't require any BC breaks
The text was updated successfully, but these errors were encountered: