Menu

#4559 (ok 4.3) Logging in causes 100% CPU usage

Latest_Git
fixed
None
1
2014-12-05
2014-10-16
No

I just downloaded the latest master branch from github and when I log in, PHP consumes 100% of one CPU on the server for about 2-3 minutes (php5-cgi process). During this time, I see the user interface like normal, but it is unresponsive. Trying to click on any links brings up the "Loading..." dialog, but they do not do anything until after the CPU usage goes down. I'm not sure if this has anything to do with running PHP through cgi, but previous versions of phpMyAdmin (e.g. 4.2.4) do not have this problem.

2 Attachments

Discussion

  • Mike Robinson

    Mike Robinson - 2014-10-16

    I forgot to mention a couple of things. This happens every time I log in, not just the first time. And once the CPU usage goes down after a few minutes, phpMyAdmin is quick and responsive until I log out and back in again.

     
  • Atul Pratap Singh

    Probably same as 4532, mb_ functions related bug.

     
  • Mike Robinson

    Mike Robinson - 2014-10-16

    OK, I did a bit of testing and I've narrowed it down to the PMA_printGitRevision(); function, and even more specifically, the PMA_Config::checkGitRevision() method. That's the culprit. Comment PMA_printGitRevision(); out in index.php and everything works fine.

     
  • Mike Robinson

    Mike Robinson - 2014-10-16

    OK, even MORE specifically, these lines are what cause the error in Config.class.php lines 584-596:

    <?php
                       for ($position = $start; $position < $end; $position++) {
                            $sha = $pmaString->strtolower(
                                bin2hex(
                                    $pmaString->substr(
                                        $index_data, $offset + ($position * 20), 20
                                    )
                                )
                            );
                            if ($sha == $hash) {
                                $found = true;
                                break;
                            }
                        }
    ?>
    

    So it may have something to do with the bug you referenced above.

     
  • Atul Pratap Singh

    Sorry, not related to 4532, didn't check your version last time, you need to update, this is a duplicate of bug 4013, already fixed for 4.1.6.

     
  • Atul Pratap Singh

    • status: open --> duplicate
    • Priority: 5 --> 1
     
  • Mike Robinson

    Mike Robinson - 2014-10-16

    So it's a regression then? Prehaps 4013 needs to be reopened in that case. I'm using version 4.3.0-dev.

     
  • Mike Robinson

    Mike Robinson - 2014-10-16

    If I change $pmaString->substr() to just use regular substr() in the code snippet above, it goes super fast. Does it really need to be multi-byte? Both mb_strlen() and mb_substr() are very slow for the data that are provided for some reason as I can see from modifying StringMB.class.php.

     
  • Atul Pratap Singh

    Indeed, on current master it is related to mb_ functions and I was able to reproduce, but sorry, due to the wrongly reported version and PMA_printGitRevision, I mistook it to be related to be 4013.
    The problem is being looked into before 4.3.0 alpha releases.

     
  • Atul Pratap Singh

    • Group: 3.3.7 --> Latest_Git
    • Priority: 1 --> 5
     
  • Atul Pratap Singh

    • status: duplicate --> open
     
  • Marc Delisle

    Marc Delisle - 2014-10-19

    There is work in progress on this subject, can you try with https://github.com/Tithugues/phpmyadmin/tree/stringFunctions_useStandardFunctions_master ?

     
    • Mike Robinson

      Mike Robinson - 2014-10-20

      Works for me.

       
  • Hugues Peccatte

    Hugues Peccatte - 2014-10-20

    I sent a PR: https://github.com/phpmyadmin/phpmyadmin/pull/1382
    Could you please test it and tell me if you still have your problem? I'm not able to reproduce it.

     
  • Hugues Peccatte

    Hugues Peccatte - 2014-10-20
    • summary: Logging in causes 100% CPU usage --> (ok 4.3) Logging in causes 100% CPU usage
    • status: open --> resolved
    • assigned_to: Hugues Peccatte
    • Priority: 5 --> 1
     
  • Hugues Peccatte

    Hugues Peccatte - 2014-10-20
     
  • Marc Delisle

    Marc Delisle - 2014-12-05
    • Status: resolved --> fixed