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

"Another probe is already profiling" with LoopClient #30

Open
maxgalbu opened this issue Jan 23, 2018 · 1 comment
Open

"Another probe is already profiling" with LoopClient #30

maxgalbu opened this issue Jan 23, 2018 · 1 comment

Comments

@maxgalbu
Copy link

maxgalbu commented Jan 23, 2018

test.php is the same code as the php sdk guide:

$ cat test.php 
<?php
require_once __DIR__.'/vendor/autoload.php';

use Blackfire\LoopClient;
use Blackfire\Client;
use Blackfire\Profile\Configuration as ProfileConfiguration;

function consume()
{
echo "Message consumed!\n";
}

$blackfire = new LoopClient(new Client(), 10);
$profileConfig = new ProfileConfiguration();
$profileConfig->setTitle('Consumer');

for (;;) {
$blackfire->startLoop($profileConfig);

consume();

if ($profile = $blackfire->endLoop()) {
print $profile->getUrl()."\n";
}

usleep(400000);
}

This is the output:

$ blackfire run php test.php
PHP Fatal error:  Uncaught exception 'Blackfire\Exception\ApiException' with message '101: An other probe is already profiling' in /var/www/hs-pv4/vendor/blackfire/php-sdk/src/Blackfire/Exception/ApiException.php:18
Stack trace:
#0 /var/www/hs-pv4/vendor/blackfire/php-sdk/src/Blackfire/Probe.php(85): Blackfire\Exception\ApiException::fromStatusCode('An other probe ...', '101')
#1 /var/www/hs-pv4/vendor/blackfire/php-sdk/src/Blackfire/Probe.php(58): Blackfire\Probe->checkError()
#2 /var/www/hs-pv4/vendor/blackfire/php-sdk/src/Blackfire/LoopClient.php(123): Blackfire\Probe->enable()
#3 /var/www/hs-pv4/test.php(18): Blackfire\LoopClient->startLoop(Object(Blackfire\Profile\Configuration))
#4 {main}
  thrown in /var/www/hs-pv4/vendor/blackfire/php-sdk/src/Blackfire/Exception/ApiException.php on line 18
Error while running command: exit status 255

Blackfire Run completed
Graph URL https://blackfire.io/profiles/7d0c5874-547a-4a2f-ae32-ef67ab604671/graph
No tests! Create some now https://blackfire.io/docs/cookbooks/tests
No recommendations

PHP version:

$ php -v
PHP 5.6.16 (cli) (built: Dec 18 2015 10:40:37) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with blackfire v1.18.1~linux-x64-zts56, https://blackfire.io, by SensioLabs
@maxgalbu
Copy link
Author

maxgalbu commented Jan 24, 2018

Apparently blackfire starts a probe as soon as the script starts. To stop it:

$probe = \BlackfireProbe::getMainInstance();
$probe->discard();

Even if I do this, after doing endLoop() nothing shows up on the blackfire.io dashboard.

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

No branches or pull requests

1 participant