Skip to content

[SWF] POJOActivityImplementation should not try to serialize arbitrary exceptions #5

Open
@manikandanrs

Description

@manikandanrs

From @christophercurrie on February 26, 2015 4:30

When an exception is thrown in an Activity implementation, POJOActivityImplementation attempts to serialize the exception using the current DataConverter. If this fails, however, it throws ActivityFailureException, for which there is no catch block to handle. This results in the exception being logged, but not returned to the Workflow, and the activity ultimately times out.

The reason this is an issue is that exceptions aren't always made to be serialized. As an example, StatementException in the JDBI package provides an accessor to the JDBC connection that triggered the exception; this connection contains a circular reference, which causes the default Jackson serializer used by JsonDataConverter to eventually throw a StackOverflowError.

To fix this, POJOActivityImplementation should only serialize exceptions that it knows will serialize safely, and should instead extract the message (and possibly the stack trace) from any unknown errors that it encounters to be serialized some other way. Otherwise, end users have to defend against this behavior by catching and wrapping problematic exceptions within Activity code, or otherwise live with Activity timeouts.

Copied from original issue: aws/aws-sdk-java#364

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions