Skip to content

SerializationException when funnelling back to the main process fails to be serialized #221

@bwoebi

Description

@bwoebi

Using zend.exception_ignore_args=0 (default)

try {
$channel->send($result);
} catch (SerializationException $exception) {
// Could not serialize task result.
$channel->send(new Internal\TaskFailure($id, $exception));
}

Whenever a $result fails to be serialized, an exception is thrown, which will include the arguments including $result in the serialization. Which then again fails to serialize, leading to the whole runner process blowing up.

There's a couple possibilities I see to solve this:
a) Force zend.exception_ignore_args=1 in the worker process.
b) Sanitize any sent Throwable's collected arguments from non-serializables.
c) Send exceptions as strings instead of serialized objects.

In my concrete use case it was caused by an exception thrown by the parallel mode of amphp/file - which was attempted to be serialized and contained some DeferredCancellation in the stacktrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions