Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Segmentation fault

Comments in 'Plugin Development' started by xiaoq, Jul 3, 2016.

  1. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    I have two questions about segmentation fault;

    First, how can a plugin cause a segmentation fault?

    Second, how to solve and fix a segmentation fault?
    Legoboy0215 likes this.
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    In PM. seg faults happen all the time. But if a seg fault occurs while a plugin is enabling or disabling, you may have to debug the plugin to norrow down to a piece of code that is causing it.
    xiaoq likes this.
  3. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    :( but the problem is it happen randomly, any ideas?
  4. Extreme_Heat
    Offline

    Extreme_Heat Active Member

    Joined:
    Apr 19, 2016
    Posts:
    76
    Minecraft User:
    Extreme_Heat
    You can't really know what caused it. Sometimes it's not even PocketMine's fault, it could just be due to an error with PHP, you running out of resources, other memory related errors, etc.

    If you consistently get segmentation faults, try removing your plugins and using a clean PHP installation.
  5. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    I once had to deal with a segfault in a fork of PM, during the php7 upgrade.
    What I did:
    -You need some linux OS for this, I recommend ubuntu. If you don't have linux anywhere use a virtual box.
    firstly the command strace:
    This may give you some information, but mostly it's not very usful.
    secoundly the command valgrind
    This helped me while getting the last C call, and i found out it was a WeakRef function call...
    so how to use it
    just enter strace/valgrind in terminal and /path/to/your/bin/php/real/binary/exectuable/file /path/to/PocketMine.php
    so for example:
    valgrind /bla/bla/bla/bin/php7/bin/php /bla/bla/bla/PocketMine.php

    If you get the error command not found do
    apt-get install valgrind/strace
  6. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Also consider using the Linux `gdb` command.

Share This Page

Advertisement