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

Undefined offset: 3 in Connection.php, Uncaught Nats\Exception: Subscription not found #111

Open
donkeywon opened this issue Aug 14, 2017 · 0 comments

Comments

@donkeywon
Copy link

donkeywon commented Aug 14, 2017

I use client to send 100k messages, the gnatsd server received all messages, but phpnats only handled about 65k messages, then php throw a error like this

Notice: Undefined offset: 3 in /var/www/html/question_tp/vendor/repejota/nats/src/Nats/Connection.php on line 405

Call Stack:
    0.0002     363904   1. {main}() /var/www/html/question_tp/test.php:0
    0.0025     537336   2. Nats\Connection->wait() /var/www/html/question_tp/test.php:52
   54.0128     538184   3. Nats\Connection->handleMSG() /var/www/html/question_tp/vendor/repejota/nats/src/Nats/Connection.php:603


Fatal error: Uncaught Nats\Exception: Subscription not found: 9c51b5c00 in /var/www/html/question_tp/vendor/repejota/nats/src/Nats/Exception.php on line 48

Nats\Exception: Subscription not found: 9c51b5c00 in /var/www/html/question_tp/vendor/repejota/nats/src/Nats/Exception.php on line 48

Call Stack:
    0.0002     363904   1. {main}() /var/www/html/question_tp/test.php:0
    0.0025     537336   2. Nats\Connection->wait() /var/www/html/question_tp/test.php:52
   54.0128     538184   3. Nats\Connection->handleMSG() /var/www/html/question_tp/vendor/repejota/nats/src/Nats/Connection.php:603

here is part of my client script, from line 26

for ($i = 0; $i < 100000; $i++) {
    $content = $faker->md5;
    $client->publish('queue', $content);
    fwrite($file, $i . " " . $content . "\n");
}

here is part of my server script, from line 38

$client->subscribe(
    'queue',
    function ($message) use (&$mysqli, &$count, &$file, &$content) {
	$count++;
	$content = $message->getBody();
        if ($mysqli->query("INSERT INTO test_nats (nats_field1) VALUES ('" . $content . "')") === false) {
            fwrite($file, "Insert failed: $count $content \n");
	} else {
            printf("%u\n", $count);
	    fwrite($file, $count . " " . $content . "\n");
	}
    }
);

$client->wait();
@donkeywon donkeywon changed the title Undefined offset: 3 in Connection.php on line 405 .... Uncaught Nats\Exception: Subscription not found Undefined offset: 3 in Connection.php, Uncaught Nats\Exception: Subscription not found Aug 14, 2017
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