1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How to debug server freezing in PMMP?

Discussion in 'Development' started by instantlyta, May 29, 2017.

  1. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    Can I debug what causes my server freeze? I know my custom plugins cause that, but it's not single-php-file-with-30-lines plugin. It's impossible to remove some codes and test for 24 hours, and restore it back.
    My server runs for sometime before it freeze. While it freeze, the server can still be queried, but not typing commands from even console. It have many players, for avarage, 70. Minigame server. I really needs the help in this. Much appreciate to you guys. :( :(
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Search "while" and "for" in your code and rethink their breaking logic one by one. An ordinary plugin, even a large one, shouldn't have too many loops, and you could pay attention to recent code.
    If rethinking doesn't work, add breakpoint debug lines to make sure they are not executed infinitely.
    PHP:
    while($strangeCondition){
      echo 
    "Strange condition is still true!\n";
    }
    Protip:
    If you are on a git repo:
    Code:
    git grep -eain \(for\|while\)\\\(
    On Un*x:
    Code:
    grep -eai --line-numbe \(for\|while\)\\\(
    In PhpStorm:
    Right-click directory/file -> Find in Path
     
  3. instantlyta

    instantlyta Slime

    Messages:
    96
    GitHub:
    intagaming
    Thanks for the detailed answer, I will report back tomorrow whether that works or not. By the way, can 100% load server (a.k.a 0 TPS server) be frozen? How to be sure that is not freezing in loop or something, but heavy load?
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    If your server is at 0 TPS, most likely it's not frozen. A server with main thread frozen does absolutely nothing on the main thread, including responding to console commands, allowing clients to join, reporting the server TPS in the process title, etc. So if you are able to know its TPS, most likely it's not completely frozen.
    Of course it's also possible that your server is gradually decreasing in TPS, tending towards 1/∞.
     
    instantlyta likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.