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

The serialized output may only be 10240 bytes long. - Is there a reason for this limit? #76

Closed
modstore opened this issue Jul 1, 2019 · 7 comments · Fixed by #86 or #213
Closed

Comments

@modstore
Copy link

modstore commented Jul 1, 2019

I want to get html responses from my callback, but this limit isn't allowing me to. Just wondering if there's a reason for this limit? Could be be something that's overridable?

$pool[] = async(function () use ($url) {
    $response = parent::request('GET', $url);

    // ...

    return $response->getBody()->getContents();
})->then(function ($response) use ($pool) {
    // ...
});

This limit is set in vendor/spatie/async/src/Runtime/ChildRuntime.php:29
$outputLength = 1024 * 10;

@modstore
Copy link
Author

Just following up on this, I decided to go another path to solve my problem, so this doesn't really matter for me any more.

@yongkyali
Copy link

@modstore I am also facing this problem. Can you please re-open this issue? At the moment, I changed the formula to $outputLength = 1024 * 100;. I don't know where this would affect, but by changing the value the code works perfectly.

@brendt
Copy link
Contributor

brendt commented Jul 19, 2019

Feel free to submit a tested PR to make in configurable

@yongkyali
Copy link

@brendt what's the purpose of the outputLength limit?

@brendt
Copy link
Contributor

brendt commented Jul 19, 2019

Outputs that are too large will crash the process. 1024 * 10 can probably be increased, though I suppose the exact amount depends on the system.

You can make this configurable if we'd add support for it:

We could make outputLength nullable, so that you could also disable it altogether.

I want to emphasize that passing these large amounts of data between the parent and child processes probably means you're using this library wrong. The idea is to offload time-consuming IO tasks as separate processes and execute them in parallel. If you need complex communication from the child process to the parent process, you're better off storing results in eg. a database and reading it from the parent process, after the child was finished.

@TheTechsTech
Copy link

I want to emphasize that passing these large amounts of data between the parent and child processes probably means you're using this library wrong.

You should show an actually example of that for proof. What are you referencing to make that claim? This is an excellent project that I see self imposed restrictions applied.

My fork has windows os support. I have also portioned it off to be just an symfony process wrapper https://github.com/symplely/processor, it does address that issue in #75.

The Symfony project has requests for an wrapper like interface: symfony/symfony#23596, symfony/symfony#8454.

@spatie spatie locked as off-topic and limited conversation to collaborators Jul 22, 2019
@brendt
Copy link
Contributor

brendt commented Sep 30, 2019

It's configurable as of 1.1.0: https://github.com/spatie/async/releases/tag/1.1.0 (#86)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants