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

Bug Report: duplicateKeyException in OpenAPI after upgrade to Payara 6.2023.6 / FISH-7965 #6369

Open
marcinpaton opened this issue Aug 18, 2023 · 10 comments
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect

Comments

@marcinpaton
Copy link

marcinpaton commented Aug 18, 2023

Brief Summary

After upgrade Payara from 6.2023.4 to 6.2023.6 we're getting exception from OpenAPI:

StandardWrapperValve[microprofile-openapi-servlet]: Servlet.service() for servlet microprofile-openapi-servlet threw exception
 java.lang.IllegalStateException: Duplicate key net.bytebuddy.implementation.bind.annotation.Argument (attempted merging values AnnotationTypeImpl{name='net.bytebuddy.implementation.bind.annotation.Argument', annotations=[ java.lang.annotation.Documented java.lang.annotation.Retention java.lang.annotation.Target], subclasses=[], parent=null, interfaces=[], implementors=[], referenced from [ ParameterImpl{null} ParameterImpl{null}]} and InterfaceModelImpl{name='net.bytebuddy.implementation.bind.annotation.Argument', annotations=[], subclasses=[], parent=null, interfaces=[], implementors=[ net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder$DelegationProcessor$Handler$Unbound$DefaultArgument]})
      at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
      at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
      at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
      at fish.payara.microprofile.openapi.impl.OpenAPISupplier.typesToMap(OpenAPISupplier.java:198)
      at fish.payara.microprofile.openapi.impl.OpenAPISupplier.collectTypesFromArchive(OpenAPISupplier.java:192)
      at fish.payara.microprofile.openapi.impl.OpenAPISupplier.get(OpenAPISupplier.java:126)
      at fish.payara.microprofile.openapi.impl.OpenApiService.getDocument(OpenApiService.java:149)
      at fish.payara.microprofile.openapi.impl.rest.app.service.OpenApiResource.getResponse(OpenApiResource.java:84)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Function TypesCtr.getAllTypes() which is used in OpenAPISupplier.typesToMap may return collection of duplicated classes so Collectors.toMap throws exception.
Probably merge function should be used in Collectors.toMap. Ex. :

    public static Map<String, Type> typesToMap(Types types) {
        return types.getAllTypes().stream()
                .collect(Collectors.toMap((t) -> t.getName(), Function.identity(), (type1, type2) -> type1));
    }

Expected Outcome

No exception

Current Outcome

Exception:
StandardWrapperValve[microprofile-openapi-servlet]: Servlet.service() for servlet microprofile-openapi-servlet threw exception
java.lang.IllegalStateException: Duplicate key net.bytebuddy.implementation.bind.annotation.Argument (attempted merging values AnnotationTypeImpl{name='net.bytebuddy.implementation.bind.annotation.Argument', annotations=[ java.lang.annotation.Documented java.lang.annotation.Retention java.lang.annotation.Target], subclasses=[], parent=null, interfaces=[], implementors=[], referenced from [ ParameterImpl{null} ParameterImpl{null}]} and InterfaceModelImpl{name='net.bytebuddy.implementation.bind.annotation.Argument', annotations=[], subclasses=[], parent=null, interfaces=[], implementors=[ net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder$DelegationProcessor$Handler$Unbound$DefaultArgument]})
at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at fish.payara.microprofile.openapi.impl.OpenAPISupplier.typesToMap(OpenAPISupplier.java:198)
at fish.payara.microprofile.openapi.impl.OpenAPISupplier.collectTypesFromArchive(OpenAPISupplier.java:192)
at fish.payara.microprofile.openapi.impl.OpenAPISupplier.get(OpenAPISupplier.java:126)
at fish.payara.microprofile.openapi.impl.OpenApiService.getDocument(OpenApiService.java:149)
at fish.payara.microprofile.openapi.impl.rest.app.service.OpenApiResource.getResponse(OpenApiResource.java:84)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Reproducer

  1. Configure OpenAPI in application deployed on Payara
  2. Visit http://host:8080/openapi/

Operating System

Ubuntu 20.04.6 LTS

JDK Version

openjdk 11.0.19 2023-04-18 LTS

Payara Distribution

Payara Server Full Profile

@marcinpaton marcinpaton added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification Type: Bug Label issue as a bug defect labels Aug 18, 2023
@kalinchan
Copy link
Member

Hi @marcinpaton, would you be able to test this in the latest version of Payara?

@kalinchan kalinchan added Status: Pending Waiting on the issue requester to give more details or share a reproducer and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels Sep 20, 2023
@marcinpaton
Copy link
Author

hi, I've tested it on 6.2023.9 and the problem still exists.

@kalinchan kalinchan added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification and removed Status: Pending Waiting on the issue requester to give more details or share a reproducer labels Sep 26, 2023
@kalinchan
Copy link
Member

Hi @marcinpaton,

Can you provide more details on how to reproduce this issue?

I have deployed the following application https://github.com/payara/Payara-Examples/tree/Payara6/microprofile/openapi-example and I am unable to reproduce this issue.

@kalinchan kalinchan added Status: Pending Waiting on the issue requester to give more details or share a reproducer and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels Sep 26, 2023
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Greetings,
It's been more than 5 days since we requested more information or an update from you on the details of this issue. Could you provide an update soon, please?
We're afraid that if we do not receive an update, we'll have to close this issue due to inactivity.

@github-actions github-actions bot added Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back and removed Type: Bug Label issue as a bug defect Status: Pending Waiting on the issue requester to give more details or share a reproducer labels Oct 2, 2023
@marcinpaton
Copy link
Author

hi, ok I will try to reproduce the issue in this sample application this or next week

@kalinchan kalinchan added Type: Bug Label issue as a bug defect Status: Open Issue has been triaged by the front-line engineers and is being worked on verification and removed Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back labels Oct 3, 2023
@fturizo fturizo assigned Elifzeynepedman and unassigned kalinchan Oct 4, 2023
@fturizo fturizo added Status: Pending Waiting on the issue requester to give more details or share a reproducer and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels Oct 12, 2023
@github-actions github-actions bot added Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back and removed Type: Bug Label issue as a bug defect Status: Pending Waiting on the issue requester to give more details or share a reproducer labels Oct 18, 2023
@github-actions
Copy link

Greetings,
It's been more than 5 days since we requested more information or an update from you on the details of this issue. Could you provide an update soon, please?
We're afraid that if we do not receive an update, we'll have to close this issue due to inactivity.

@marcinpaton
Copy link
Author

Hi @kalinchan
Please do the following steps to reproduce the bug:

  1. Clone and build this sample application: https://github.com/marcinpaton/payaraSwagger
  2. Deploy payaraSwagger.war on newest version of payara
  3. To verify if application started properly open link: http://localhost:8080/payaraSwagger/api/hello-world - 'Hello, World!' message should appear.
  4. Open this link in browser: http://localhost:8080/payaraSwagger/api/openapi-ui/index.html - you will see the following error message: 'Failed to load API definition'.
  5. Check server.log to see exceptions.

@Elifzeynepedman Elifzeynepedman added Status: Open Issue has been triaged by the front-line engineers and is being worked on verification and removed Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back labels Oct 21, 2023
@Elifzeynepedman
Copy link

Hi @marcinpaton,

Many thanks for providing the reproducer, I was able to reproduce the issue and I have escalated this to the platform development team as FISH-7965.

Thank you,
Elif

@Elifzeynepedman Elifzeynepedman added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect and removed Status: Open Issue has been triaged by the front-line engineers and is being worked on verification labels Oct 25, 2023
@Elifzeynepedman Elifzeynepedman changed the title Bug Report: duplicateKeyException in OpenAPI after upgrade to Payara 6.2023.6 Bug Report: duplicateKeyException in OpenAPI after upgrade to Payara 6.2023.6 / FISH-7965 Dec 26, 2023
@pdurbin
Copy link

pdurbin commented Jan 10, 2024

@kalinchan @Elifzeynepedman hi! I'm glad you're able to reproduce the bug thanks to @marcinpaton.

Any news on FISH-7965 or a fix? We've been using /openapi to programmatically generate client code and we (the Dataverse team) would love to have it working again.

Thanks for Payara! It's a great product! ❤️

@ghunteranderson
Copy link
Contributor

This issue is affecting all the applications across my teams as well. Unfortunately, we've not found a workaround yet.

I've opened PR #6563 with @marcinpaton's suggested solution. Local testing confirms this change addresses the issue for our applications.

Feel free to let me know if there's anything I can help with this one. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

6 participants