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

Usage of JBoss Marshalling incompatible with native compilation with GraalVM #127

Open
jmartisk opened this issue Jan 13, 2020 · 8 comments

Comments

@jmartisk
Copy link
Contributor

jmartisk commented Jan 13, 2020

BatchUtil class currently uses a org.jboss.marshalling.cloner.ObjectCloner. Native compilation yields this (the actual log is much longer and less readable, showing just the most important piece here)

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing org.jboss.marshalling.reflect.SerializableField.setShort(java.lang.Object, short) 
(...)
Caused by: com.oracle.svm.hosted.analysis.flow.SVMMethodTypeFlowBuilder$UnsafeOffsetError: Field AnalysisField<SerializableField.fieldOffset accessed: false reads: true written: true> is used as an offset in an unsafe operation, but no value recomputation found.
 Wrapped field: HotSpotResolvedJavaFieldImpl<org.jboss.marshalling.reflect.SerializableField.fieldOffset long:16>

We might need to get rid of JBoss Marshalling, or hack around it somehow, but I'm not yet sure if it's possible.

@jmartisk
Copy link
Contributor Author

jmartisk commented Jan 13, 2020

  • Switching to plain Java serialization won't help, that's not supported in native images
  • I think we can't use @RecomputeFieldValue substitution for the SerializableField.fieldOffset field, because the underlying field (of which we store the offset) changes dynamically

Options:

  • Find/implement a different cloning mechanism
  • Rework the model classes in a way that they become immutable, and therefore cloning will not be needed; and pass the context needed for starting jobs using new additional objects rather than by mutating job definition objects
  • any other ideas? @chengfang WDYT?

@jmartisk
Copy link
Contributor Author

Hey @stuartwdouglas what would be your suggestion for this please? I suppose we would need to get rid of JBoss Marshalling if we indeed wanted to integrate JBeret into Quarkus?

@stuartwdouglas
Copy link
Contributor

What exactly is this used for? The correct solution will likely depend on the use case.

@jmartisk
Copy link
Contributor Author

jmartisk commented Jan 20, 2020

@stuartwdouglas see https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/util/BatchUtil.java#L124
It's used as a general mechanism to clone objects (in particular, the Job class that holds a batch job definition)

@radcortez
Copy link
Contributor

Here is a proposal to remove JBoss Marshalling:
6fb5892

This is using MapStruct to generate the clone / copy code for the Job model.

@chengfang
Copy link
Contributor

MapStruct, if used, will be a new dependency for both JBeret and WildFly. Is it already used in any other of our projects? If so how is the experience?

@radcortez
Copy link
Contributor

@gunnarmorling is one of the creators of the project, so he can probably give additional feedback :)

I don't think it is a major problem, since MapStruct is set as provided and is not required at runtime. It is only used to generate the code for map / copy the objects. The annotations are compile only, so in the end you just have a simple interface with the generated implementation.

@maxandersen
Copy link

related to #133

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

No branches or pull requests

5 participants