Kissaki / MumPI

A Webinterface for Mumble Server. Written in PHP, using Ice middleware.
http://kissaki.github.io/MumPI/
Other
105 stars 30 forks source link

PHP running out of memory while executing ServerInterface.php (memory leak ?) using ice 3.7 and php 8.2 #77

Open t0uch opened 2 months ago

t0uch commented 2 months ago

Hello,

I've been using your software without any issues for several years using Ice 3.4 & php5 but i had to completely reinstall my setup because my distro (raspbian - debian 8) wasn't supported anymore and I couldn't update my mumble server to be compatible with mumble client 1.5+ My new setup uses Raspberry Pi OS (debian 12), apache2 v2.4, PHP v8.2 and Ice v3.7

Here is the apache error.log last line :

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4147642368 bytes) in ServerInterface.php on line 155

line 155 is : $servers = $this->meta->getAllServers();

note that this error also triggers on line 131 : $this->meta->getVersion($major, $minor, $patch, $text); but i've managed to make it work by returning "1.5" directly as a string and commenting out the upper line which allowed me to get the homepage working and it also triggers at line 204 : $server = $this->meta->getServer(intval($srvid)); depending if I click either on "Login" or "Admin" button on the homepage.

I use default config in php.ini which sets the memory limit to 128M I don't really see why it should need more ram to process a single mumble server (which has <10 channels and <10 concurrent users) (and I didn't increased this value on my previous install, even though it was working)

Thanks for the help

Kissaki commented 2 months ago

Hello,

yeah, that seems suspect. I don't see why it would hit such high limits.

Kissaki commented 2 months ago

getServer returns a Server which doesn't even include a list of users or channels.

Kissaki commented 2 months ago

How did you test getServer only? Did you comment out getAllServers?

t0uch commented 2 months ago

I've only commented out the logic in the getVersion() function as I saw $this->version is a string so I could just return a handcrafted one:

    public function getVersion()
    {
    /* if ($this->meta != null && $this->version == null) {
            $this->meta->getVersion($major, $minor, $patch, $text);
            $this->version = $major . '.' . $minor . '.' . $patch . ' ' . $text;
        }
        return $this->version;
    */
        return "1.5"; 
    }

But i'm absolutely not familiar with either Ice or mumble API and I have no idea of the expected return type for the getServers() or getServer($srvid) function. I haven't tested anything else because it feels beyond my knowledge.

With getVersion() "fixed", it allowed me to have the homepage working but then if I click on the Login or Register button, I get the php error line 155 (ie. within the getServers() function) and the Admin button triggers the error on line 204 (getServer() function)

t0uch commented 2 months ago

The 3 times this error occurs, it's always when there is a call to the $this->meta property but I can't tell if the error occurs when accessing the poperty or affecting the result in a variable

Kissaki commented 2 months ago

I wonder if it's a PHP Ice lib issue.