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

Log exceptions that cannot be serialized #26322

Open
tommyk-gears opened this issue May 3, 2024 · 0 comments · May be fixed by #26323
Open

Log exceptions that cannot be serialized #26322

tommyk-gears opened this issue May 3, 2024 · 0 comments · May be fixed by #26323

Comments

@tommyk-gears
Copy link
Contributor

tommyk-gears commented May 3, 2024

Please describe the problem you are trying to solve
When executing actions remotely via e.g. an executor service, and the remote party throws an exception that can not be serialised, then the response to the client is made up of a HazelcastSerializationException. This makes sense since the "real" error cannot be transmitted since it is not serialisable.
In this situation one would want to track down the source of the non-serialisable exception and fix it. However, this may turn out to be harder than necessary since the faulty exception is never logged with its stacktrace (it is only mentioned by class name in the HazelcastSerializationException).

Please describe the desired behavior
I would like the non-serialisable exception to be logged on the "remote" side after serialisation failed, but before it is discarded and replaced with a HazelcastSerializationException.

I think this can be achieved by inserting this code in com.hazelcast.internal.serialization.impl.SerializationUtil#handleSerializeException (before the last return statement);

if (rootObject instanceof Throwable throwable) {
      LOGGER.warning("Failed to serialize '" + clazz + "'. It will be logged here and " +
             "then ignored and replaced with a HazelcastSerializationException.", throwable);
}

Describe alternatives you've considered
I considered injecting a custom com.hazelcast.nio.serialization.Serializer that mainly delegates to the internal Hazelcast logics, but also logs exceptions when serialisation fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant