Skip to content

Incorrect handle big message #21

Open
@Logioniz

Description

@Logioniz

When message is big then you should collect whole message via chunk of data.

In Client.php you have this code:

    protected function setConnectionHandlers(): void
    {
        $this->connection->on('data', function ($chunk) {
            $parsed = $this->parser->parseRawResponse($chunk);
            $this->resolveRequests($parsed);
        });
        ...
   }

It looks like you are not collecting the complete message through pieces of data, i.e. you think you have a full response from the server.

Test to check problem:

<?php

$loader = require __DIR__ . '/vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

use \seregazhuk\React\Memcached\Factory;

$memcached = Factory::createClient($loop, '127.0.0.1:9003');

$memcached->set('a', str_repeat('a', 1000000))
        ->then(function () use ($memcached) {
            return $memcached->get('a');
        })
        ->then(function ($data) use ($loop) {
            // var_dump($data);
            var_dump(1111);
            $loop->stop();
        });

$loop->run();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions