tarantool/tarantool-php

TarantoolException: request sync is not equal response sync

baltazorbest opened this issue · 9 comments

When I try execute upsert method with big array, I have error:

PHP Fatal error:  Uncaught TarantoolException: request sync is not equal response sync. closing connection in /home/username/test.php:28`
Stack trace:
#0 /home/username/test.php(28): Tarantool->upsert('testing', Array, Array)
#1 {main}
  thrown in /home/username/test.php on line 28"

OS: centos 6.8 x86_64
PHP: 7.0.8
Tarantool: 1.7.1.123-1.el6.x86_64

PHP script:

$tnt = new Tarantool('127.0.0.1:3302');
$tnt->connect();
$space = "testing";
$key = "key_1";
$data = array(
    "id"=> 10224539,
    "category_id" => 176,
    "ccategory_id" => 176,
    "testmode" => 2,
    "fulldays" => 30,
    "lifetime" => 12324,
    "uid" => 2397,
    "userid" => 21176,
    "tags_cl_id" => 3499,
    "pricecost" => "10",
);
$tnt->upsert($space, array($key, $data), array(array("field" => 1,"op" => "=","arg" => $data)));

testing.lua box:

box.cfg {
    wal_dir="/home/username/testing/wal";
    snap_dir="/home/username/testing/snap";
    vinyl_dir="/home/username/testing/vinyl";
    listen = 3302;
    custom_proc_title = 'testing';
    slab_alloc_arena = 1.5;
    slab_alloc_minimal = 16;
    slab_alloc_maximal = 10485760;
    slab_alloc_factor = 1.06;
    snapshot_period = 300;
    snapshot_count = 10;
    panic_on_snap_error = true;
    panic_on_wal_error = true;
    rows_per_wal = 5000000;
    snap_io_rate_limit = nil;
    wal_mode = "write";
    wal_dir_rescan_delay = 2.0;
    io_collect_interval = nil;
    readahead = 16320;
    log_level = 5;
    logger_nonblock = true;
    too_long_threshold = 0.5;
}

local function bootstrap()
    local space = box.schema.create_space('testing', {id=1024})
    space:create_index('primary', {type = 'hash', parts = {1, 'STR'}})
    box.schema.user.grant('guest', 'read,write,execute', 'universe')
end

box.once('testing-1.0', bootstrap)

Are you sure, that this bug is still in php7-v2? I can't reproduce it.

Any update on this?

cebeh commented

PHP 7.0.8-0ubuntu0.16.04.3
tarantool: 1.7.2-263-g1f3f7ac
tarantool-php: 0.2.0

still reproduce

tt.php code

<?php
$tnt = new Tarantool('127.0.0.1:3302');
$tnt->connect();
$space = "attr";
$rows = [
    1   => [
        'traffic' =>
            [
                581 => 1,
                633 => 1,
                820 => 1,
            ],
    ],
    666 => [
        'traffic' => [
            405 => 36,
            563 => 34,
            565 => 28,
            581 => 23,
            631 => 25,
            633 => 35,
            669 => 19,
            671 => 18,
            674 => 26,
            676 => 28,
            718 => 14,
            752 => 1,
            754 => 1,
            756 => 1,
            796 => 22,
            800 => 22,
            808 => 19,
            810 => 17,
            814 => 14,
            820 => 7,
            830 => 13,
            838 => 15,
            842 => 15,
            846 => 9,
            848 => 9,
            850 => 7,
            858 => 11,
            876 => 1,
            878 => 2,
            880 => 1,
        ],
    ],

];
foreach ($rows as $key => $data) {
    echo 'upsert key: ' . $key . PHP_EOL;
    $tnt->upsert($space, [$key, $data], [["field" => 1, "op" => "=", "arg" => $data]]);
}
seven@shelby:~$ php tt.php 
upsert key: 1
upsert key: 666
PHP Fatal error:  Uncaught TarantoolException: request sync is not equal response sync. closing connection in /home/seven/tt.php:52
Stack trace:
#0 /home/seven/tt.php(52): Tarantool->upsert('attr', Array, Array)
#1 {main}
  thrown in /home/seven/tt.php on line 52

box.space.attr

---
- index:
    0: &0
      unique: true
      parts:
      - type: unsigned
        fieldno: 1
      id: 0
      space_id: 520
      name: primary
      type: TREE
    primary: *0
  on_replace: 'function: 0x41466680'
  temporary: false
  id: 520
  engine: vinyl
  enabled: true
  name: attr
  field_count: 0
...

Hello, Dmitriy.

Well, that (usually) means that previous request has been timedout. You
haven't observed anything? Are you using Vinyl?

With best regards, Eugene.

2016-11-23 15:06 GMT+03:00 Dmitriy Protasov notifications@github.com:

PHP 7.0.8-0ubuntu0.16.04.3
tarantool: 1.7.2-263-g1f3f7ac
tarantool-php: 0.2.0

still reproduce

tt.php code

connect();$space = "attr";$rows = [ 1 => [ 'traffic' => [ 581 => 1, 633 => 1, 820 => 1, ], ], 666 => [ 'traffic' => [ 405 => 36, 563 => 34, 565 => 28, 581 => 23, 631 => 25, 633 => 35, 669 => 19, 671 => 18, 674 => 26, 676 => 28, 718 => 14, 752 => 1, 754 => 1, 756 => 1, 796 => 22, 800 => 22, 808 => 19, 810 => 17, 814 => 14, 820 => 7, 830 => 13, 838 => 15, 842 => 15, 846 => 9, 848 => 9, 850 => 7, 858 => 11, 876 => 1, 878 => 2, 880 => 1, ], ],];foreach ($rows as $key => $data) { echo 'upsert key: ' . $key . PHP_EOL; $tnt->upsert($space, [$key, $data], [["field" => 1, "op" => "=", "arg" => $data]]);} seven@shelby:~$ php tt.php upsert key: 1 upsert key: 666 PHP Fatal error: Uncaught TarantoolException: request sync is not equal response sync. closing connection in /home/seven/tt.php:52 Stack trace:#0 /home/seven/tt.php(52): Tarantool->upsert('attr', Array, Array)#1 {main} thrown in /home/seven/tt.php on line 52 — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com//issues/104#issuecomment-262496798, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeQFLxz8Qmfnv7wOqjRykm52aTcImCVks5rBCxggaJpZM4J3RR5 .

I need full test-case, if you can provide it (with Tarantool configuration
file).

With best regards, Eugene.

2016-11-23 15:39 GMT+03:00 Eugine Blikh bigbes@gmail.com:

Hello, Dmitriy.

Well, that (usually) means that previous request has been timedout. You
haven't observed anything? Are you using Vinyl?

With best regards, Eugene.

2016-11-23 15:06 GMT+03:00 Dmitriy Protasov notifications@github.com:

PHP 7.0.8-0ubuntu0.16.04.3
tarantool: 1.7.2-263-g1f3f7ac
tarantool-php: 0.2.0

still reproduce

tt.php code

connect();$space = "attr";$rows = [ 1 => [ 'traffic' => [ 581 => 1, 633 => 1, 820 => 1, ], ], 666 => [ 'traffic' => [ 405 => 36, 563 => 34, 565 => 28, 581 => 23, 631 => 25, 633 => 35, 669 => 19, 671 => 18, 674 => 26, 676 => 28, 718 => 14, 752 => 1, 754 => 1, 756 => 1, 796 => 22, 800 => 22, 808 => 19, 810 => 17, 814 => 14, 820 => 7, 830 => 13, 838 => 15, 842 => 15, 846 => 9, 848 => 9, 850 => 7, 858 => 11, 876 => 1, 878 => 2, 880 => 1, ], ],];foreach ($rows as $key => $data) { echo 'upsert key: ' . $key . PHP_EOL; $tnt->upsert($space, [$key, $data], [["field" => 1, "op" => "=", "arg" => $data]]);} seven@shelby:~$ php tt.php upsert key: 1 upsert key: 666 PHP Fatal error: Uncaught TarantoolException: request sync is not equal response sync. closing connection in /home/seven/tt.php:52 Stack trace:#0 /home/seven/tt.php(52): Tarantool->upsert('attr', Array, Array)#1 {main} thrown in /home/seven/tt.php on line 52 — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com//issues/104#issuecomment-262496798, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeQFLxz8Qmfnv7wOqjRykm52aTcImCVks5rBCxggaJpZM4J3RR5 .
cebeh commented

Found case how to reproduce exception:

  1. create guest user without password
  2. connect without authentication
  3. execute upsert with big array

When using authentication there is no exception

test/shared/box.lua

@@ -18,6 +18,7 @@ box.cfg{
 }
 
 box.once('initialization', function()
+    box.schema.user.grant('guest', 'read,write,execute', 'universe')
     box.schema.user.create('test', { password = 'test' })
     box.schema.user.create('test_empty', { password = '' })
     box.schema.user.create('test_big', {

test/AuthMsgPackTest.php

<?php

class AuthMsgPackTest extends PHPUnit_Framework_TestCase
{
    protected static $tarantool;

    protected static $data = [
        'small'   => [
            1 => 2,
            2 => 3,
        ],
        'big' => [
            405 => 36,
            563 => 34,
            565 => 28,
            581 => 23,
            631 => 25,
            633 => 35,
            669 => 19,
            671 => 18,
            674 => 26,
            676 => 28,
            718 => 14,
            752 => 1,
            754 => 1,
            756 => 1,
            796 => 22,
            800 => 22,
            808 => 19,
            810 => 17,
            814 => 14,
            820 => 7,
            830 => 13,
            838 => 15,
            842 => 15,
            846 => 9,
            848 => 9,
            850 => 7,
            858 => 11,
            876 => 1,
            878 => 2,
            880 => 1,
        ],
    ];

    public function test_01_guest_user_msgpack()
    {
        self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT'));
        self::$tarantool->ping();

        self::$tarantool->upsert("msgpack", [7, "insert big array with sub arrays", self::$data], [[
            'field' => 2,
            'op'    => '=',
            'arg'   => self::$data,
        ]]);
        $resp = self::$tarantool->select("msgpack", [7]);
        $this->assertEquals(count($resp[0][2]['big']), 30);
        $this->assertTrue(True);
    }

    public function test_02_authorized_user_msgpack()
    {
        self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT'));
        self::$tarantool->authenticate('test', 'test');

        self::$tarantool->upsert("msgpack", [7, "insert big array with sub arrays", self::$data], [[
            'field' => 2,
            'op'    => '=',
            'arg'   => self::$data,
        ]]);
        $resp = self::$tarantool->select("msgpack", [7]);
        $this->assertEquals(count($resp[0][2]['big']), 30);
        $this->assertTrue(True);
    }
}

Thank you, Dmitry! I'll try it tomorrow.

With best regards, Eugene.

2016-11-23 17:27 GMT+03:00 Dmitriy Protasov notifications@github.com:

Found case how to reproduce exception:

  1. create guest user without password
  2. connect without authentication
  3. execute upsert with big array

When using authentication there is no exception

test/shared/box.lua
https://github.com/tarantool/tarantool-php/edit/php7-v2/test/shared/box.lua

@@ -18,6 +18,7 @@ box.cfg{
}

box.once('initialization', function()+ box.schema.user.grant('guest', 'read,write,execute', 'universe')
box.schema.user.create('test', { password = 'test' })
box.schema.user.create('test_empty', { password = '' })
box.schema.user.create('test_big', {

test/AuthMsgPackTest.php

[ 1 => 2, 2 => 3, ], 'big' => [ 405 => 36, 563 => 34, 565 => 28, 581 => 23, 631 => 25, 633 => 35, 669 => 19, 671 => 18, 674 => 26, 676 => 28, 718 => 14, 752 => 1, 754 => 1, 756 => 1, 796 => 22, 800 => 22, 808 => 19, 810 => 17, 814 => 14, 820 => 7, 830 => 13, 838 => 15, 842 => 15, 846 => 9, 848 => 9, 850 => 7, 858 => 11, 876 => 1, 878 => 2, 880 => 1, ], ]; public function test_01_guest_user_msgpack() { self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT')); self::$tarantool->ping(); self::$tarantool->upsert("msgpack", [7, "insert big array with sub arrays", self::$data], [[ 'field' => 2, 'op' => '=', 'arg' => self::$data, ]]); $resp = self::$tarantool->select("msgpack", [7]); $this->assertEquals(count($resp[0][2]['big']), 30); $this->assertTrue(True); } public function test_02_authorized_user_msgpack() { self::$tarantool = new Tarantool('localhost', getenv('PRIMARY_PORT')); self::$tarantool->authenticate('test', 'test'); self::$tarantool->upsert("msgpack", [7, "insert big array with sub arrays", self::$data], [[ 'field' => 2, 'op' => '=', 'arg' => self::$data, ]]); $resp = self::$tarantool->select("msgpack", [7]); $this->assertEquals(count($resp[0][2]['big']), 30); $this->assertTrue(True); }} — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com//issues/104#issuecomment-262526412, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeQFHJHHwTfNJd1vsf6IaZzfvGkHc6Xks5rBE1rgaJpZM4J3RR5 .
kvspb commented

up

AKEB commented

2018-02-20 18:34:24.456 [36943] iproto xrow.c:59 E> ER_INVALID_MSGPACK: Invalid MsgPack - packet header
2018-02-20 18:34:24.462 [36943] iproto iproto.cc:744 E> ER_INVALID_MSGPACK: Invalid MsgPack - packet length