Skip to content
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

Random php exit 127 on Windows 64-bit/segfault on Linux #90

Closed
L3ice opened this issue Nov 6, 2016 · 21 comments
Closed

Random php exit 127 on Windows 64-bit/segfault on Linux #90

L3ice opened this issue Nov 6, 2016 · 21 comments
Labels
Category: Core Related to internal functionality Category: PHP (extension) Resolution: Obsolete Superseded by other changes

Comments

@L3ice
Copy link

L3ice commented Nov 6, 2016

Issue description

Using the default setting of async-workers(auto) ends in an Error:
bin\php\php.exe: Exit 127

Steps to reproduce the issue

  1. set async-workers in pocketmine.yml to auto
  2. Start the server

OS and versions

  • PocketMine-MP: 074583d
  • PHP: 7.0.3
  • Server OS: Windows 10(1607) 64 Bit
  • Game version: -

Crashdump, backtrace or other files

*2016-11-06 19_57_41-pocketmine-mp
http://pastebin.com/AMxMqjL6

@dktapps
Copy link
Member

dktapps commented Nov 6, 2016

Are you certain this is caused by this setting? Try to reproduce it a few times?

@dktapps dktapps added Category: Core Related to internal functionality Status: Unconfirmed Bug has not yet been reproduced by a maintainer labels Nov 6, 2016
@L3ice
Copy link
Author

L3ice commented Nov 6, 2016

I tried it several times.
Using 1 or 2 before and then set it back to auto.

@tnytown
Copy link
Contributor

tnytown commented Nov 7, 2016

Looks fine on my end using 074583d. Tested in two environments: Windows 10 Pro 14951 & (official) PHP 7.0.3, MacOS 10.12.1 & (non-standard) PHP 7.0.12.

@L3ice
Copy link
Author

L3ice commented Nov 7, 2016

Interesting.
Using the number of cores I have(4), gives the same error.
So it detects my cores correctly.
So it must be something different.
I did not test it with 4 yesterday, because I didn't know how many cores I have.

@dktapps dktapps changed the title auto detection of AsyncTask worker does not work properly on various operating systems Random php exit 127 on Windows 64-bit Nov 8, 2016
@dktapps
Copy link
Member

dktapps commented Nov 8, 2016

Reproduced on Windows 10 Home 64-bit 14393.531 with php 7.0.12 x64, circumstances unknown. First try this happened, second time it started up fine.

@dktapps dktapps added Status: Reproduced Bug has been reproduced, but cause has not yet been identified and removed Status: Unconfirmed Bug has not yet been reproduced by a maintainer labels Nov 8, 2016
@L3ice
Copy link
Author

L3ice commented Nov 8, 2016

I did run it now from source and it also happend only at the first start with php 7.0.3 x64.

@dktapps
Copy link
Member

dktapps commented Nov 9, 2016

This points to a recursive function call. While the observed random exit 127 (and on Linux, random segmentation fault) is a pthreads bug, as it should yield an out of memory error, this points to an issue within the PocketMine core itself.

@dktapps dktapps changed the title Random php exit 127 on Windows 64-bit Random php exit 127 on Windows 64-bit/segfault on Linux Nov 9, 2016
@KAGsundaram
Copy link

" First try this happened, second time it started up fine." - dktapps

Exactly what I saw the first two times I started PocketMine-MP_1.6.1dev-73_794ff643_API-2.1.0.

However, I have loaded half a dozen different Pocketmine forks in the past three days, and I have seen this randomly occurring exit 127 in all of them.

It is NOT running out of physical memory; I have the system monitor constantly displayed, only 57% max of my 8GB is in use.

@KAGsundaram
Copy link

Quoting Avdi in Ruby Tapas - Episode #385 - Error 127:

"AHA! It turns out, 127 is a standard shell command exit status value, and it means “command not found”. "

https://www.rubytapas.com/2016/02/22/episode-385-error-127/

@dktapps
Copy link
Member

dktapps commented Nov 23, 2016

Program received signal SIGSEGV, Segmentation fault.
malloc_consolidate (av=av@entry=0x7ffff650e760 <main_arena>)
    at malloc.c:4149
4149              size = p->size & ~(PREV_INUSE|NON_MAIN_ARENA);
(gdb) bt
#0  malloc_consolidate (av=av@entry=0x7ffff650e760 <main_arena>)
    at malloc.c:4149
#1  0x00007ffff61d1ea5 in _int_malloc (
    av=av@entry=0x7ffff650e760 <main_arena>, bytes=bytes@entry=16384)
    at malloc.c:3443
#2  0x00007ffff61d38dc in __GI___libc_malloc (bytes=16384)
    at malloc.c:2895
#3  0x00007ffff7773251 in yaml_parser_initialize ()
   from /home/dktapps/test/bundle/bin/php7/bin/../lib/libyaml-0.so.2
#4  0x00000000007109ed in ?? ()
#5  0x00007fffffffa510 in ?? ()
#6  0x00007fffca6ee398 in ?? ()
#7  0x0000000000000000 in ?? ()
(gdb)

From a CentOS server (x64) php 7.0.12

@robske110
Copy link
Contributor

Yaml?!

@dktapps
Copy link
Member

dktapps commented Nov 24, 2016

I'm seeing config-related segfaults like this very frequently, yes. It appears to be an extension issue as opposed to a core bug.

@jduncanator
Copy link

jduncanator commented Dec 6, 2016

Appears to be failing here, not quite sure why yet, but to me it seems like a libc bug, rather than a yaml, PHP or PocketMine bug.

Another potential cause may be heap trashing by another piece of code that results in a malloc segfault, but I'm surprised it always fails in the same place.

@Tolo0
Copy link

Tolo0 commented Feb 4, 2017

Any solution?

@Tolo0
Copy link

Tolo0 commented Feb 4, 2017

Problem maybe solved. thanks to SalmonGER for the advice
pocketmine.yml / async-workers fault.
pocketmine cant use more than 4 cores so if ur dedicated server has more than 4 and u have async-workers set to auto. You will get segmentation fault.

#Set this approximately to your number of cores.

#If set to auto, it'll try to detect the number of cores (or use 2)
async-workers: 4

@dktapps
Copy link
Member

dktapps commented Feb 4, 2017

Actually, if you look at https://travis-ci.org/pmmp/PocketMine-MP/builds/198337842, you'll see that in Travis at least it can use 32 cores...

@dktapps dktapps closed this as completed Feb 4, 2017
@dktapps dktapps reopened this Feb 4, 2017
@Tolo0
Copy link

Tolo0 commented Feb 4, 2017

its not a fix its just a temporary solution. it worked for me so im sure it will help others. i have no knowledge with coding but it could be something to do with the async-workers part of code. my dedicated server has 8 cores but pocketmine doesnt let me use all 8. only 4 max so i don't know how anyone would use 32. maybe its worth looking into.

@jduncanator
Copy link

I've got a little more info on this one since December.

Running Valgrind over the php binary running PocketMine throws a whole swathe of issues out, which could point to a bigger issue. I haven't had time to sort through the issues reported, but when I do, I'll report back here.

@dktapps
Copy link
Member

dktapps commented Feb 6, 2017

I haven't had time to investigate this myself... but there is one annoying segfault that almost always occurs on shutdown on Travis.

@KurojakiKaoru
Copy link

I had this problem today, all I had to do was update my php binaries for pocketmine. I was using PHP 7.0.3 and updated to 7.0.18 and everything seems to be working now.

@dktapps
Copy link
Member

dktapps commented Jul 30, 2017

The issues described in this issue are due to ZTS issues in PHP 7.0 and 7.1. We'll be upgrading to PHP 7.2 as soon as possible. PHP 7.2 fixes a wide range of stability issues such as this.

Since this is a PHP issue and not PocketMine, I'm going to close this.

@dktapps dktapps closed this as completed Jul 30, 2017
@dktapps dktapps added Resolution: Abandoned PR has been abandoned by its author and removed Status: Reproduced Bug has been reproduced, but cause has not yet been identified labels Jul 30, 2017
@dktapps dktapps added Resolution: Obsolete Superseded by other changes and removed Resolution: Abandoned PR has been abandoned by its author labels Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core Related to internal functionality Category: PHP (extension) Resolution: Obsolete Superseded by other changes
Projects
None yet
Development

No branches or pull requests

8 participants