On Windows, shutdown will hang at "Stopping CommandReader thread" until another input is received, such as hitting the Enter key.
stream_set_blocking() does not work on Windows. This results in the fgets() call to stdin to block the thread until another input is received. This issue does not occur on Linux as far as I can tell.
This is a rather difficult problem to resolve cleanly. Since Thread::kill() was removed from pthreads in v3, the thread cannot be forcefully killed.
I have made a previous attempt to resolve this with an implementation using stream_select which _also_ fails on Windows (returns 1 when no streams have changed >:-[)
https://github.com/PocketMine/PocketMine-MP/issues/3990
https://bugs.php.net/bug.php?id=34972
I've already reported that to @PEMapModder before in Feb :P
On 14 October 2016 at 16:34, Dylan K. Taylor [email protected]
wrote:
Issue description
On Windows, shutdown will hang at "Stopping CommandReader thread" until
another input is received, such as hitting the Enter key.
Why this happensstream_set_blocking() does not work on Windows. This results in the
fgets() call to stdin to block the thread until another input is
received. This issue does not occur on Linux as far as I can tell.
Possible solutionsThis is a rather difficult problem to resolve cleanly. Since
Thread::kill() was removed from pthreads in v3, the thread cannot be
forcefully killed.
I have made a previous attempt to resolve this with an implementation
using stream_select which _also_ fails on Windows (returns 1 when no
streams have changed >:-[)
Steps to reproduce the issue
- Shut down a PocketMine server on Windows using /stop
OS and versions
- PocketMine-MP: 2fba107
https://github.com/pmmp/PocketMine-MP/commit/2fba1073ddf4965eb5d2bbbbbfb4a5c5f9377db3- PHP: 7.0+
- OS: Any Windows version
References
PocketMine/PocketMine-MP#3990
https://github.com/PocketMine/PocketMine-MP/issues/3990
https://bugs.php.net/bug.php?id=34972—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pmmp/PocketMine-MP/issues/25, or mute the thread
https://github.com/notifications/unsubscribe-auth/ARVBWt38EMUe5YYFbN1EMg3O2NjUBwGbks5qz4TOgaJpZM4KXA5P
.
Can't we just fake the input?
@PrimusLV I tried, it either fails or segfaults.
Confirmed on linux too
I don't have this in macosx, can't believe this happening on Linux
It happens on centos! If i stop server , i need to write a letter and submit , to stop! Didnt try to simply press enter xd!
This strangely doesn't happen to me.
And for all who have this issue on Linux/UNIX-based stuff try to update php. I don't think that this can happen in any Linux system
THIS IS NOT A FORUM. Continue to treat it as one and bans will start getting handed out.
Reproduced on other platforms (circumstances unknown).
stream_set_blocking() only works on Mac and maybe some Linux versions, but it is mainly a Mac thing. We had a discussion about this a while ago.
Found the cause of the stream_select issue, seems to be a MINTTY bug. Running in PowerShell or CMD it works perfectly.
Correction: not a MINTTY bug, just bad implementation. PHP CLI sees MINTTY as a pipe instead of an actual console. Reference: https://github.com/mintty/mintty/issues/56. The same issue occurs on Travis using a blocking STDIN stream. The cause of this is that stream_select will always return 1 if the input is piped.
Most helpful comment
I don't have this in macosx, can't believe this happening on Linux