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

Can not run native with quarkus-jaxp and quarkus-jaxb #359

Open
cdmikechen opened this issue Jun 9, 2022 · 9 comments
Open

Can not run native with quarkus-jaxp and quarkus-jaxb #359

cdmikechen opened this issue Jun 9, 2022 · 9 comments

Comments

@cdmikechen
Copy link

cdmikechen commented Jun 9, 2022

I have some requirements for parsing xml, so I import quarkus-jaxp and quarkus-jaxb. However, I found that after native compiled and started operator, the operator would have the following errors.

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-06-09 14:52:09,428 INFO  [io.qua.ope.run.OperatorProducer] (main) Quarkus Java Operator SDK extension 4.0.0.RC (commit: d5c33a0 on branch: d5c33a0527a48162a716734d710bf5268e404351) built on Tue May 31 22:23:40 CST 2022
2022-06-09 14:52:09,430 INFO  [io.jav.ope.Operator] (main) Registered reconciler: 'hadoopconfigreconciler' for resource: 'class com.pesco.operator.hadoop.config.crd.HadoopConfig' for namespace(s): [all namespaces]
2022-06-09 14:52:09,430 INFO  [io.jav.ope.Operator] (main) Registered reconciler: 'rangerreconciler' for resource: 'class com.pesco.operator.ranger.crd.Ranger' for namespace(s): [all namespaces]
2022-06-09 14:52:09,431 INFO  [io.jav.ope.Operator] (main) Registered reconciler: 'hadoopconfigfolderreconciler' for resource: 'class com.pesco.operator.hadoop.folder.crd.HadoopConfigFolder' for namespace(s): [all namespaces]
2022-06-09 14:52:09,431 INFO  [io.qua.ope.run.AppEventListener] (main) Starting operator.
2022-06-09 14:52:09,431 INFO  [io.jav.ope.Operator] (main) Operator SDK 3.0.2 (commit: 51a37fa) built on Tue May 31 03:03:34 CST 2022 starting...
2022-06-09 14:52:09,431 INFO  [io.jav.ope.Operator] (main) Client version: 5.12.2
2022-06-09 14:52:09,431 INFO  [io.jav.ope.pro.Controller] (main) Starting 'hadoopconfigreconciler' controller for reconciler: com.pesco.operator.hadoop.config.HadoopConfigReconciler_ClientProxy, resource: com.pesco.operator.hadoop.config.crd.HadoopConfig
2022-06-09 14:52:09,431 INFO  [io.jav.ope.pro.Controller] (ForkJoinPool.commonPool-worker-3) Starting 'rangerreconciler' controller for reconciler: com.pesco.operator.ranger.RangerReconciler_ClientProxy, resource: com.pesco.operator.ranger.crd.Ranger
2022-06-09 14:52:10,286 INFO  [io.jav.ope.pro.Controller] (main) 'hadoopconfigreconciler' controller started, pending event sources initialization
2022-06-09 14:52:10,314 ERROR [io.fab.kub.cli.inf.cac.SharedProcessor] (ForkJoinPool.commonPool-worker-3) Failed invoking io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource@7d6afd7c event handler: null: java.lang.NullPointerException
	at io.javaoperatorsdk.operator.processing.event.ResourceID.fromFirstOwnerReference(ResourceID.java:17)
	at io.javaoperatorsdk.operator.processing.event.source.informer.Mappers.lambda$fromOwnerReference$0(Mappers.java:35)
	at io.javaoperatorsdk.operator.processing.event.source.informer.PrimaryToSecondaryIndex.onAddOrUpdate(PrimaryToSecondaryIndex.java:20)
	at io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource.onAdd(InformerEventSource.java:98)
	at io.javaoperatorsdk.operator.processing.event.source.informer.InformerEventSource.onAdd(InformerEventSource.java:66)
	at io.fabric8.kubernetes.client.informers.cache.ProcessorListener$AddNotification.handle(ProcessorListener.java:96)
	at io.fabric8.kubernetes.client.informers.cache.ProcessorListener.add(ProcessorListener.java:47)
	at io.fabric8.kubernetes.client.informers.cache.SharedProcessor.lambda$distribute$0(SharedProcessor.java:79)
	at io.fabric8.kubernetes.client.informers.cache.SharedProcessor.lambda$distribute$1(SharedProcessor.java:101)
	at io.fabric8.kubernetes.client.utils.SerialExecutor.lambda$execute$0(SerialExecutor.java:40)
	at io.fabric8.kubernetes.client.utils.SerialExecutor.scheduleNext(SerialExecutor.java:52)
	at io.fabric8.kubernetes.client.utils.SerialExecutor.execute(SerialExecutor.java:46)
	at io.fabric8.kubernetes.client.informers.cache.SharedProcessor.distribute(SharedProcessor.java:98)
	at io.fabric8.kubernetes.client.informers.cache.SharedProcessor.distribute(SharedProcessor.java:79)
	at io.fabric8.kubernetes.client.informers.cache.ProcessorStore.update(ProcessorStore.java:50)
	at io.fabric8.kubernetes.client.informers.cache.ProcessorStore.update(ProcessorStore.java:28)
	at io.fabric8.kubernetes.client.informers.cache.Reflector.lambda$listSyncAndWatch$0(Reflector.java:85)
	at java.util.ArrayList.forEach(ArrayList.java:1541)
	at io.fabric8.kubernetes.client.informers.cache.Reflector.listSyncAndWatch(Reflector.java:82)
	at io.fabric8.kubernetes.client.informers.impl.DefaultSharedIndexInformer.run(DefaultSharedIndexInformer.java:146)
	at io.javaoperatorsdk.operator.processing.event.source.informer.InformerWrapper.start(InformerWrapper.java:36)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.util.concurrent.ConcurrentHashMap$ValueSpliterator.forEachRemaining(ConcurrentHashMap.java:3605)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
	at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:408)
	at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:736)
	at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:661)
	at io.javaoperatorsdk.operator.processing.event.source.informer.InformerManager.start(InformerManager.java:44)
	at io.javaoperatorsdk.operator.processing.event.source.informer.ManagedInformerEventSource.start(ManagedInformerEventSource.java:75)
	at io.javaoperatorsdk.operator.processing.event.NamedEventSource.start(NamedEventSource.java:20)
	at io.javaoperatorsdk.operator.processing.event.EventSourceManager.start(EventSourceManager.java:68)
	at io.javaoperatorsdk.operator.processing.Controller.start(Controller.java:305)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1693)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
	at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)

Here is my jaxb and jaxp import packages, I use quarkus 2.9.2 and oeprator-sdk 4.0.0.RC.

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jaxp</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jaxb</artifactId>
    </dependency>
@metacosm
Copy link
Member

metacosm commented Jun 9, 2022

There's probably something else at play here because the error doesn't seem like it'd be something impacted by XML parsing…

@metacosm
Copy link
Member

metacosm commented Jun 9, 2022

Actually, strike that… Do you have JAXP/JAXB annotations on your custom resource?

@metacosm
Copy link
Member

metacosm commented Jun 9, 2022

Just to be sure: the same code works in JVM mode? Also, is there a way to replicate the issue?

@cdmikechen
Copy link
Author

cdmikechen commented Jun 9, 2022

@metacosm
I've tested in jvm mode. No error is reported in jvm mode and it can run normally.

I have just made some attempts. If I ignore these errors, native service returns to its normal state after continuously reporting errors for a period of time.
But this is a probabilistic event because I use KubernetesDependentResource a lot. Therefore, when starting for the first time, if there are some CRs, these dependent resources will not be found.

@cdmikechen
Copy link
Author

The reason why I introduced jaxb and jaxp is that I found some errors like the following errors when parsing xml. Therefore, I imported these two packages to solve the instantiation of related classes.

Caused by: javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: com.sun.org.apache.xpath.internal.functions.FuncNormalizeSpace.<init>()
	at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:170)
	at com.pesco.operator.hadoop.config.dependent.HadoopConfigConfigMapResource.getContent(HadoopConfigConfigMapResource.java:135)
	... 20 more
Caused by: javax.xml.transform.TransformerException: com.sun.org.apache.xpath.internal.functions.FuncNormalizeSpace.<init>()
	at com.sun.org.apache.xpath.internal.compiler.FunctionTable.getFunction(FunctionTable.java:353)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compileFunction(Compiler.java:1060)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compile(Compiler.java:204)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compileOperation(Compiler.java:245)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.equals(Compiler.java:324)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compile(Compiler.java:160)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.predicate(Compiler.java:695)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compilePredicates(Compiler.java:1033)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.getCompiledPredicates(Compiler.java:986)
	at com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.initPredicateInfo(PredicatedNodeTest.java:180)
	at com.sun.org.apache.xpath.internal.axes.DescendantIterator.<init>(DescendantIterator.java:127)
	at com.sun.org.apache.xpath.internal.axes.WalkerFactory.newDTMIterator(WalkerFactory.java:258)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.locationPath(Compiler.java:675)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compile(Compiler.java:206)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compile(Compiler.java:152)
	at com.sun.org.apache.xpath.internal.compiler.Compiler.compileExpression(Compiler.java:126)
	at com.sun.org.apache.xpath.internal.XPath.<init>(XPath.java:187)
	at com.sun.org.apache.xpath.internal.XPath.<init>(XPath.java:268)
	at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:162)
	... 21 more

I mainly parse xml files and xml text, but I haven't used annotations yet.

@cdmikechen
Copy link
Author

I will do more tests to confirm the core of the problem. Please wait a little longer.

@cdmikechen
Copy link
Author

cdmikechen commented Jun 9, 2022

@metacosm
Hi~ I fount that if I added a KubernetesDependentResource, the native operator will appear NPE problem.
image

At present, I still can't debug the native mode, so I don't know which object is not initialized. Can you continue to track this problem?

@metacosm
Copy link
Member

metacosm commented Jun 9, 2022

The problem that occurs is that most likely your resource is not being properly deserialised due to some conflict between Jackson (which is heavily used by the fabric8 client) and JAXB/JAXP… so in the code above, the NPE most likely occurs because resource is null

Now the question is why the resource cannot properly be deserialised? Without being able to replicate the issue, it's difficult to tell.

Is running natively a requirement? It's important to note that for the operator use case, native compilation is typically less interesting than for micro services. Indeed, operators behave similarly to traditional server applications for which the JVM is particularly well suited so the benefits of native compilation are smaller for operators.

@cdmikechen
Copy link
Author

cdmikechen commented Jun 9, 2022

@metacosm
After removing jaxb and jaxp, it seems that there will still be exceptions. I simplified the codes and push it to GitHub. You can try this with native, please.
https://github.com/cdmikechen/Operator-Dependent-Test

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

2 participants