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

PHP Soapclient memory issue #86

Open
koen-php opened this issue Aug 3, 2018 · 3 comments
Open

PHP Soapclient memory issue #86

koen-php opened this issue Aug 3, 2018 · 3 comments
Labels

Comments

@koen-php
Copy link

koen-php commented Aug 3, 2018

Hi, I'm using your great library to continuously check updates in the status of different Sonos speakers. However, I notice that the memory usage keeps increasing and it seems to be related to the PHP SoapClient.

If I go into the Device.php and comment the Soap call to get e.g. the volume status, the used memory stabilizes:
$result = $soap->__soapCall($action, $soapParams);

Is this a known issue and what can I do about it?

@duncan3dc
Copy link
Owner

Hi @koen-php, I've not come across this myself before, I'll do some investigation and see if I can reproduce.

If you could provide a small test script that demonstrates the issue that would be really helpful, thanks

@duncan3dc duncan3dc added the bug label Aug 3, 2018
@koen-php
Copy link
Author

koen-php commented Aug 3, 2018

Here is a simple CLI script that will get the volume of 1 speaker every second. In the output you will see the result and the current memory usage. On my device, the used memory increases on every iteration with 120:


<?php 

require __DIR__ . '/vendor/autoload.php';

$i = 1;
while (true) {
    echo "Iteration $i: - Memory usage: " . memory_get_usage() . "/" . memory_get_peak_usage() . "\n";
    try {
        $sonos = new duncan3dc\Sonos\Network(new Doctrine\Common\Cache\ArrayCache());
        if ($sonos) {
            $speaker = $sonos->getSpeakerByRoom('Woonkamer');
            if ($speaker) {
                echo "SUCCESS: Volume = " . $speaker->getVolume() . "\n";
            }
            else {
                echo "FAIL: speaker is null\n";
            }
        }
        else {
            echo "FAIL: network is null\n";
        }
        
    }
    catch (Exception $e) {
        echo "FAIL: Exception = " . $e->getMessage() . "\n";
    }    
    $i++;
    sleep(1);
}

?>

@duncan3dc
Copy link
Owner

I've tracked that to an issue in the PHP extension itself, but not been able to solve yet, I'll let you know once I get anywhere with upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants