michaeljmarshall opened a new issue #14080: URL: https://github.com/apache/pulsar/issues/14080
**Describe the bug** The test logs for the `ServerCnxTest` class are filled with NPEs making it hard to read through the logs. The cause of the NPE is the following method: https://github.com/apache/pulsar/blob/f78fdacdfbf99c80e0dc61c396b70187c631aabf/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java#L68-L78 The `namespaceResources` are set to `null` in the following constructor, presumably because we don't have any other values to use for the test. https://github.com/apache/pulsar/blob/f78fdacdfbf99c80e0dc61c396b70187c631aabf/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/PulsarResources.java#L59-L72 **To Reproduce** Steps to reproduce the behavior: 1. Run the tests for `ServerCnxTest` class. **Expected behavior** It'd be nice to avoid NPEs in the tests so that our logs are more meaningful. **Screenshots** ``` 2021-11-16T22:37:43,412-0600 [TestNG-method=testCreateProducerTimeoutThenCreateSameNamedProducerShouldFail-1] WARN org.apache.pulsar.broker.service.BacklogQuotaManager - Failed to read policies data, will apply the default backlog quota: namespace=prop/use/ns-abc java.lang.NullPointerException: null at org.apache.pulsar.broker.service.BacklogQuotaManager.getBacklogQuota(BacklogQuotaManager.java:70) ~[classes/:?] at org.apache.pulsar.broker.service.BacklogQuotaManager.getBacklogQuota(BacklogQuotaManager.java:82) ~[classes/:?] at org.apache.pulsar.broker.service.persistent.PersistentTopic.getBacklogQuota(PersistentTopic.java:2468) ~[classes/:?] at org.apache.pulsar.broker.service.persistent.PersistentTopic.isBacklogQuotaExceeded(PersistentTopic.java:2477) ~[classes/:?] at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$21(ServerCnx.java:1193) ~[classes/:?] at java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:753) ~[?:?] at java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731) ~[?:?] at java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2108) ~[?:?] at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$23(ServerCnx.java:1188) ~[classes/:?] at java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:680) [?:?] at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:658) [?:?] at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2094) [?:?] at org.apache.pulsar.broker.service.ServerCnx.handleProducer(ServerCnx.java:1145) [classes/:?] at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:194) [pulsar-common-2.10.0-SNAPSHOT.jar:2.10.0-SNAPSHOT] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [netty-codec-4.1.68.Final.jar:4.1.68.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) [netty-codec-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:343) [netty-transport-4.1.68.Final.jar:4.1.68.Final] at org.apache.pulsar.broker.service.ServerCnxTest.testCreateProducerTimeoutThenCreateSameNamedProducerShouldFail(ServerCnxTest.java:897) [test-classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132) [testng-7.3.0.jar:?] at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:45) [testng-7.3.0.jar:?] at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:73) [testng-7.3.0.jar:?] at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11) [testng-7.3.0.jar:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:829) [?:?] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
