[BUG] LogAnalytics Batch Queries - MaxServerTimeOut is always null #29339
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
Monitor
Monitor, Monitor Ingestion, Monitor Query
Describe the bug
When creating LogAnalytics batch queries with QueryOptions setting serverTimeOut, a comparison over null value is performed in:
azure-sdk-for-java/sdk/monitor/azure-monitor-query/src/main/java/com/azure/monitor/query/models/LogsBatchQuery.java
Line 75 in 6dd0236
maxServerTimeout is not previously set, so always null.
Exception or Stack Trace
java.lang.NullPointerException: null at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603) at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678) at java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:737) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159) at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.evaluateParallel(ForEachOps.java:188) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233) at java.base/java.util.stream.IntPipeline.forEach(IntPipeline.java:439) at java.base/java.util.stream.IntPipeline$Head.forEach(IntPipeline.java:596) at com.nexthink.LogAnalyticsDataProcessor.startProcessing(LogAnalyticsDataProcessor.java:37) at com.nexthink.Application.onApplicationEvent(Application.java:32) at com.nexthink.Application.onApplicationEvent(Application.java:13) at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:262) at io.micronaut.context.event.ApplicationEventPublisherFactory.access$200(ApplicationEventPublisherFactory.java:60) at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229) at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:479) at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:303) at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:110) at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:78) at java.base/java.util.Optional.ifPresent(Optional.java:176) at io.micronaut.runtime.Micronaut.start(Micronaut.java:76) at io.micronaut.runtime.Micronaut.run(Micronaut.java:320) at io.micronaut.runtime.Micronaut.run(Micronaut.java:306) at com.nexthink.Application.main(Application.java:25) Caused by: java.lang.NullPointerException: Cannot read field "seconds" because "otherDuration" is null at java.base/java.time.Duration.compareTo(Duration.java:1410) at com.azure.monitor.query.models.LogsBatchQuery.addWorkspaceQuery(LogsBatchQuery.java:75) at com.nexthink.logAnalytics.LogAnalyticsQueryService.nxSourceEventQuery(LogAnalyticsQueryService.java:60) at com.nexthink.LogAnalyticsDataProcessor.lambda$startProcessing$0(LogAnalyticsDataProcessor.java:40) at java.base/java.util.stream.ForEachOps$ForEachOp$OfInt.accept(ForEachOps.java:204) at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104) at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
To Reproduce
Steps to reproduce the behavior:
Code Snippet
LogsBatchQuery logsBatchQuery = new LogsBatchQuery(); String query1 = logsBatchQuery.addWorkspaceQuery("{workspace-id}", "{query-1}", new QueryTimeInterval(Duration.ofDays(2)), new LogsQueryOptions().setServerTimeout(Duration.ofSeconds(60)));
Expected behavior
Max query duration properly set.
Screenshots
Setup (please complete the following information):
If you suspect a dependency version mismatch (e.g. you see
NoClassDefFoundError
,NoSuchMethodError
or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:mvn dependency:tree -Dverbose
)Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
The text was updated successfully, but these errors were encountered: