question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with non-serializable classes in exceptions with fork VM

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
loicmathieucommented, May 28, 2020

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.

1reaction
loicmathieucommented, May 26, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found