Skip to content

Parent vs Worker Decoder maxlength differences #76

Description

@jhard

$in = new Decoder($process->stdout, true, 512, 0, 16 * 1024 * 1024);

has $in = new Decoder($process->stdout, true, 512, 0, 16 * 1024 * 1024); = 16mb maxlength

$in = new Decoder($through);

and
$in = new Decoder(new ReadableResourceStream(\STDIN, $loop));

don't supply maxlength to the Decoder constructor, and get the default 65536 from
https://github.com/clue/reactphp-ndjson/blob/60c4f980a4f7fb5d415be2ab4ad4d41522110d19/src/Decoder.php#L33

That feels like a mistake, or is there a reason to limit the worker side so severely?

I ran into this trying to send large statements. I'm by far no reactphp expert, but this seems to be the cause for my problems. If I send a large package, I get a "Database closed" Exception.

a script to demonstrate the problem (works fine for e.g. str_repeat('a', 50000)):

<?php
require 'vendor/autoload.php';
use Clue\React\SQLite\Factory;
$factory = new Factory();

$factory->open(':memory:')->then(function ($db) {
    $db->exec('CREATE TABLE t (id INTEGER PRIMARY KEY, test TEXT)');

    $db->query('INSERT INTO t (test) VALUES (?)', [str_repeat('a', 100000)])->then(
        function () { echo "big insert: OK\n"; exit; },
        function (Exception $e) { echo 'big insert rejected: ' . $e->getMessage() . "\n"; }
    );
});

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