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

tolerate null GRPC schema descriptor #1705

Closed
codefromthecrypt opened this issue Apr 9, 2019 · 0 comments · Fixed by #1715
Closed

tolerate null GRPC schema descriptor #1705

codefromthecrypt opened this issue Apr 9, 2019 · 0 comments · Fixed by #1715
Labels
Milestone

Comments

@codefromthecrypt
Copy link
Contributor

io.grpc.MethodDescriptor.getSchemaDescriptor() is nullable and not of a guaranteed type. It would be nice to rid the NPE here for a debug log message.

java.lang.NullPointerException: null
	at com.linecorp.armeria.server.grpc.GrpcDocServicePlugin.lambda$generateSpecification$1(GrpcDocServicePlugin.java:154) ~[armeria-grpc-0.83.0.jar:?]
	at java.util.HashMap.computeIfAbsent(HashMap.java:1127) ~[?:1.8.0_181]
	at com.linecorp.armeria.server.grpc.GrpcDocServicePlugin.generateSpecification(GrpcDocServicePlugin.java:150) ~[armeria-grpc-0.83.0.jar:?]
	at com.linecorp.armeria.server.docs.DocService.lambda$generate$3(DocService.java:173) ~[armeria-0.83.0.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_181]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:1.8.0_181]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_181]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_181]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_181]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_181]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_181]
	at com.linecorp.armeria.server.docs.DocService.generate(DocService.java:175) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.server.docs.DocService.access$100(DocService.java:80) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.server.docs.DocService$1.serverStarting(DocService.java:159) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.server.Server$ServerStartStopSupport.notifyStarting(Server.java:473) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.server.Server$ServerStartStopSupport.notifyStarting(Server.java:266) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.common.util.StartStopSupport.notifyListeners(StartStopSupport.java:342) ~[armeria-0.83.0.jar:?]
	at com.linecorp.armeria.common.util.StartStopSupport.lambda$start$3(StartStopSupport.java:171) ~[armeria-0.83.0.jar:?]
	at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:248) [netty-common-4.1.34.Final.jar:4.1.34.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.34.Final.jar:4.1.34.Final]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
@trustin trustin added the defect label Apr 12, 2019
@trustin trustin added this to the 0.84.0 milestone Apr 15, 2019
trustin added a commit to trustin/armeria that referenced this issue Apr 15, 2019
Motivation:

While `GrpcDocServicePlugin` scans the gRPC services to retrieve their
`ServiceDescriptor`s, a `NullPointerException` can occurs in some
services.

Modifications:

- Skip the service whose `getServiceDescriptor()` and
  `getSchemaDesciptor()` return `null`.
- Skip the service whose `getSchemaDescriptor()` returns a descriptor
  that's not a `ProtoFileDescriptorSupplier`.

Result:

- No more NPE
- Fixes line#1705
trustin added a commit that referenced this issue Apr 15, 2019
Motivation:

While `GrpcDocServicePlugin` scans the gRPC services to retrieve their
`ServiceDescriptor`s, a `NullPointerException` can occur in some
services.

Modifications:

- Skip the service whose `getServiceDescriptor()` and
  `getSchemaDesciptor()` return `null`.
- Skip the service whose `getSchemaDescriptor()` returns a descriptor
  that's not a `ProtoFileDescriptorSupplier`.

Result:

- No more NPE
- Fixes #1705
fmguerreiro pushed a commit to fmguerreiro/armeria that referenced this issue Sep 19, 2020
Motivation:

While `GrpcDocServicePlugin` scans the gRPC services to retrieve their
`ServiceDescriptor`s, a `NullPointerException` can occur in some
services.

Modifications:

- Skip the service whose `getServiceDescriptor()` and
  `getSchemaDesciptor()` return `null`.
- Skip the service whose `getSchemaDescriptor()` returns a descriptor
  that's not a `ProtoFileDescriptorSupplier`.

Result:

- No more NPE
- Fixes line#1705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants