Issue with non-serializable classes in exceptions with fork VM
See original GitHub issueDescribe the bug When the VM is forked, all the test results from the forked VM are serialized to disk to be sent to the origin VM.
This uses Java Serialization.
If some non-serializable class is used inside the exception code of an exception thrown by the test, this leads to a crash of QuickPerf due to java.lang.IllegalStateException
.
Expected behavior (Describe the expected behavior clearly and concisely.)
Actual behavior
An error on Micronaut 2.0.0.M3 will generate the following stacktraces as it uses a non-serializable class
Unable to run test in a new JMV: Exception in thread "main" java.lang.IllegalStateException: Unable to save failures.
at org.quickperf.repository.ObjectFileRepository.buildSerializationException(ObjectFileRepository.java:49)
at org.quickperf.repository.ObjectFileRepository.save(ObjectFileRepository.java:44)
at org.quickperf.repository.BusinessOrTechnicalIssueRepository.save(BusinessOrTechnicalIssueRepository.java:35)
at org.quickperf.testlauncher.TestRunnerFromMain.executeTestMethod(TestRunnerFromMain.java:40)
at org.quickperf.junit5.QuickPerfJunit5Core.main(QuickPerfJunit5Core.java:24)
Caused by: java.io.NotSerializableException: io.micronaut.http.client.exceptions.HttpClientErrorDecoder$1
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1185)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
at java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1553)
at java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1510)
at java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1433)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1179)
at java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
at org.quickperf.repository.ObjectFileRepository.save(ObjectFileRepository.java:41)
... 3 more
Versions
- QuickPerf: master
- JDK: 11
- OS: Unbuntu 20.04
- Database (if SQL annotation bug): H2
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
kotlinx-serialization gets confused with non-serializable generics
Describe the bug To describe the problem(s), let's start with a working example: class Foo(val str: String) @Serializable sealed class Base ...
Read more >Why can't the compiler detect this error regarding Serializable ...
The compiler is designed to check the code based on the requirements of the language, not an individual library. The language could be...
Read more >How to solve Not Serializable Exception - Examples Java ...
The simplest solution is to find the class that throws the exception and make it implement the Serializable interface. · In case the...
Read more >NotSerializableException in Java with Examples
In Java, a NotSerializableException exception is thrown when an instance of a class must implement the Serializable interface.
Read more >Java static code analysis: The non-serializable super class of ...
Therefore the non-serializable ancestor of a Serializable class must have a no-arg constructor. Otherwise the class is Serializable but not deserializable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The NPE issue was because the driver didn’t set the dataSourceName and connectionId inside the Connection info when creating the connection proxy which generates a NPE when serializing the ExecutionInfo.
I’ll try to create a reproducer for the original serialization issue.
Thanks for debugging this, I naively think that the issue on the reproducer is the same but it’s not. Anyway, the orgininal issue is real, it’s the reproducer that is wrong.
Can you re-open the issue? I’ll try to create another reproducer.