Quarkus: wrong proxy bytecode generated for FacesContext#getNamingContainerSeparatorChar()

Created on 4 Jun 2019  路  22Comments  路  Source: quarkusio/quarkus

I currently create a extension for JSF/MyFaces and it seems that the proxy generation creates wrong bytecode for this single case:

Steps to reproduce:

NOTE:
it works fine when using mvn compile quarkus:dev

Following exception happens:

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    org/apache/myfaces/cdi/JsfArtifactProducer_ProducerMethod_getFacesContext_6432ec49e096ea975e673cec96a0eaae1039fc21_ClientProxy.getNamingContainerSeparatorChar()C @7: areturn
  Reason:
    Type integer (current frame, stack[0]) is not assignable to reference type
  Current Frame:
    bci: @7
    flags: { }
    locals: { 'org/apache/myfaces/cdi/JsfArtifactProducer_ProducerMethod_getFacesContext_6432ec49e096ea975e673cec96a0eaae1039fc21_ClientProxy' }
    stack: { integer }
  Bytecode:
    0x0000000: 2ab6 000e b600 28b0                    

        at org.apache.myfaces.cdi.JsfArtifactProducer_ProducerMethod_getFacesContext_6432ec49e096ea975e673cec96a0eaae1039fc21_Bean$$function$$30.get(Unknown Source)
        at io.quarkus.arc.LazyValue.get(LazyValue.java:42)
        at org.apache.myfaces.cdi.JsfArtifactProducer_ProducerMethod_getFacesContext_6432ec49e096ea975e673cec96a0eaae1039fc21_Bean.get(Unknown Source)
        at org.apache.myfaces.cdi.JsfArtifactProducer_ProducerMethod_getFacesContext_6432ec49e096ea975e673cec96a0eaae1039fc21_Bean.get(Unknown Source)
        at io.quarkus.arc.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:310)
        at io.quarkus.arc.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:322)
        at io.quarkus.arc.BeanManagerImpl.getReference(BeanManagerImpl.java:74)

If you can't resolve MyFace 3.0.0-SNAPSHOT, please clone https://github.com/apache/myfaces.git and do a mvn install -DskipTests

arearc kinbug

All 22 comments

@mkouba I think there's a good chance it's a bug in the code generated by ArC? Could you take a look and confirm that?

@mkouba this issue is (currently) the last issue of my myfaces extension for quarkus. If this issue is fixed, do you like to host the extension as official quarkus extension?
The extension is here: https://github.com/tandraschko/quarkus-myfaces
I think i would need to create some tests and release MyFaces 3.x M1.

@tandraschko Hm, I've just tried to reproduce the issue. The app starts and nothing happens when I click the button. What version of JDK do you use? And the generated bytecode looks ok.

WRT official extension - you should probably send a question to https://groups.google.com/forum/#!forum/quarkus-dev.

@mkouba hmmm, works currently @$work
@rmpestano can you check it again with the current sources? Works fine for me on Java8 and 11.

@mkouba, which version of Quarkus are you using?

@rmpestano I did not change the version in the reproducer, so it's 0.16.1. Are you testing against the master branch?

Yea also in 0.16.1. In fact It doesn't happens anymore on the reproducer but still happens (same stack by the way) on my app.

I will isolate the issue and contribute back to the reproducer project.

The issue is still happening on the reproducer, we are just not seeing it.

Set the project stage to development in MyFacesProcessor here (unfortunately I could not override the project stage on the reproducer, we need to look at that @tandraschko), install the extension and run the reproducer again, the exception will be raised when the button is clicked (only in jar mode).

initParam.produce(new ServletInitParamBuildItem("javax.faces.PROJECT_STAGE", "Development"));

Hm, what does the development project stage from MyFaces POV?

In the case of this issue it enables this exception handler which prints the exception on the console. So instead of changing the projectStage (if you thing it is related to this issue) you could also remove the IF from the exception handler so the exception can be printed on the console

What rafael means is that the exception is silently ignored, as we add our exceptionhandler only in Dev stage currently
Actually MyFaces should send a Error 500, we need to improve this but also fix the real issue

@rmpestano i tried to reproduce it and i really can't. Seems that it just happen on my other machine.
Maybe really a JDK thing.

I can reproduce on jdk8 and 11, oracle and openjdk:

~/projetos/quarkus-myfaces/quarkus-myfaces-showcase$ java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

can you make a PR to make my sample fail, so @mkouba can also check it without modifying the code?

I'm using your sample as is, the only think @mkouba needs to change is to set the project stage to development in quarkus-myfaces as described in this comment, so the stacktrace gets printed to console.

Also if you try to run the sample project using the native profile you get the same exception at build time:

mvn clean package -Pnative -Dnative-image.docker-build=true

It's very likely a gizmo bug: https://github.com/quarkusio/gizmo/issues/14.

Hi @mkouba, just to confirm, the fix was not merged into quarkus 0.18, right?

Yup, it didn't make it, we need a new Gizmo release.

@gsmet is there any expected release date for gizmo?

@tandraschko sorry, I'm releasing as we speak. I will upgrade for Wednesday's release.

This one fell through the cracks.

Just tested with quarkus 0.20.0 and it is working great, thank you guys!

Was this page helpful?
0 / 5 - 0 ratings