Ran across similar NullPointerException on Atomic update . Some pointers -
the input update contained more than one update for the same unique id .
the atomic update  operation was doing both 'remove' and add and some value
was null.
add-distinct without null value fixed it.

On Thu, Mar 28, 2024 at 3:54 AM Akhilesh kumar. <akhiles...@outlook.com>
wrote:

> Hello all,
>
> We’re using Solr for our e-commerce platform since many years. We do a lot
> of real-time updates and rely on the atomic updates mostly to update the
> documents. We ran into an issue with the atomic updates with add-distinct
> on the production environment, where we are getting NullPointerException.
>
> Input document: [SolrInputDocument(fields: [id=10001,
> promotionType={add-distinct=WHOLESALE},
> lastUpdatedTime={set=1711433462524}])],
>
> update field definition: <field name="promotionType" type="string"
> docValues="true" multiValued="true" indexed="false" stored="true"/>
>
> Solr version: 8.11.2 running on Cloud mode.
>
> We were unable to replicate this locally (solr setup in cloud mode running
> single sharded collection with only few doucments) while on production we
> have millions of docs in multi-sharded collection.
>
> Attaching the logs:
> org.apache.solr.client.solrj.impl.CloudSolrClient$RouteException: Error
> from server at {hostname}/solr/collection_shard6_replica_t2737:
> java.lang.NullPointerException     at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.doAddDistinct(AtomicUpdateDocumentMerger.java:466)
>  at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.mergeDocHavingSameId(AtomicUpdateDocumentMerger.java:174)
>   at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.mergeChildDocRecursive(AtomicUpdateDocumentMerger.java:115)
> at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.merge(AtomicUpdateDocumentMerger.java:106)
>  at
> org.apache.solr.update.processor.DistributedUpdateProcessor.getUpdatedDocument(DistributedUpdateProcessor.java:730)
> at
> org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:380)
>   at
> org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:343)
>    at
> org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50)  at
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:343)
> at
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:229)
> at
> org.apache.solr.update.processor.DistributedZkUpdateProcessor.processAdd(DistributedZkUpdateProcessor.java:245)
> at
> org.apache.solr.handler.loader.JavabinLoader$1.update(JavabinLoader.java:110)
>   at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readOuterMostDocIterator(JavaBinUpdateRequestCodec.java:344)
>  at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readIterator(JavaBinUpdateRequestCodec.java:292)
>  at
> org.apache.solr.common.util.JavaBinCodec.readObject(JavaBinCodec.java:338)
>  at
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:283)  at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readNamedList(JavaBinUpdateRequestCodec.java:245)
> at
> org.apache.solr.common.util.JavaBinCodec.readObject(JavaBinCodec.java:303)
>  at
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:283)  at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:196)
>   at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec.unmarshal(JavaBinUpdateRequestCodec.java:131)
>    at
> org.apache.solr.handler.loader.JavabinLoader.parseAndLoadDocs(JavabinLoader.java:122)
>   at
> org.apache.solr.handler.loader.JavabinLoader.load(JavabinLoader.java:70)
>  at
> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:97)
>   at
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:82)
>    at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216)
>   at org.apache.solr.core.SolrCore.execute(SolrCore.java:2637)    at
> org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:791)  at
> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:564)     at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427)
>    at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357)
>    at
> org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)   at
> org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
>   at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>   at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
>   at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
>   at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
>    at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
>   at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
>   at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
>    at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
>   at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>   at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)
> at
> org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)
>   at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
>   at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at
> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
>    at
> org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763)
>  at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:516)  at
> org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)
>  at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)  at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)    at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
> at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
> at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
>    at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
>  at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
>    at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
>   at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
>  at
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
>   at java.base/java.lang.Thread.run(Thread.java:829)      at
> org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:125)
>   at
> org.apache.solr.client.solrj.impl.CloudSolrClient.getRouteException(CloudSolrClient.java:46)
>    at
> org.apache.solr.client.solrj.impl.BaseCloudSolrClient.directUpdate(BaseCloudSolrClient.java:579)
>    at
> org.apache.solr.client.solrj.impl.BaseCloudSolrClient.sendRequest(BaseCloudSolrClient.java:1076)
>    at
> org.apache.solr.client.solrj.impl.BaseCloudSolrClient.requestWithRetryOnStaleState(BaseCloudSolrClient.java:934)
>    at
> org.apache.solr.client.solrj.impl.BaseCloudSolrClient.request(BaseCloudSolrClient.java:866)
> at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:214)
>  at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106)     at
> org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71)  at
> org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:85)  at
> com.gdn.x.search.service.impl.SolrDataServiceV2Impl.redirectUpdateRequest(SolrDataServiceV2Impl.java:708)
>   at
> com.gdn.x.search.service.impl.SolrDataServiceV2Impl.updateAndHandleException(SolrDataServiceV2Impl.java:806)
>    at
> com.gdn.x.search.service.impl.SolrDataServiceV2Impl.updateThrottler(SolrDataServiceV2Impl.java:757)
> at
> com.gdn.x.search.service.impl.SolrDataServiceV2Impl.update(SolrDataServiceV2Impl.java:880)
>  at
> com.gdn.x.search.service.impl.SolrDataServiceV2Impl.lambda$atomicUpdateList$61(SolrDataServiceV2Impl.java:2031)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)   at
> com.gdn.x.search.other.service.helper.wrapper.ContextAwarePoolExecutor.lambda$wrap$0(ContextAwarePoolExecutor.java:35)
>  at
> datadog.trace.bootstrap.instrumentation.java.concurrent.Wrapper.run(Wrapper.java:46)
>    at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>   at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>   at java.base/java.lang.Thread.run(Thread.java:834) Caused by:
> org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
> from server at {hostname}/solr/collection_shard6_replica_t2737:
> java.lang.NullPointerException    at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.doAddDistinct(AtomicUpdateDocumentMerger.java:466)
>  at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.mergeDocHavingSameId(AtomicUpdateDocumentMerger.java:174)
>   at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.mergeChildDocRecursive(AtomicUpdateDocumentMerger.java:115)
> at
> org.apache.solr.update.processor.AtomicUpdateDocumentMerger.merge(AtomicUpdateDocumentMerger.java:106)
>  at
> org.apache.solr.update.processor.DistributedUpdateProcessor.getUpdatedDocument(DistributedUpdateProcessor.java:730)
> at
> org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:380)
>   at
> org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:343)
>    at
> org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50)  at
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:343)
> at
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:229)
> at
> org.apache.solr.update.processor.DistributedZkUpdateProcessor.processAdd(DistributedZkUpdateProcessor.java:245)
> at
> org.apache.solr.handler.loader.JavabinLoader$1.update(JavabinLoader.java:110)
>   at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readOuterMostDocIterator(JavaBinUpdateRequestCodec.java:344)
>  at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readIterator(JavaBinUpdateRequestCodec.java:292)
>  at
> org.apache.solr.common.util.JavaBinCodec.readObject(JavaBinCodec.java:338)
>  at
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:283)  at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec$StreamingCodec.readNamedList(JavaBinUpdateRequestCodec.java:245)
> at
> org.apache.solr.common.util.JavaBinCodec.readObject(JavaBinCodec.java:303)
>  at
> org.apache.solr.common.util.JavaBinCodec.readVal(JavaBinCodec.java:283)  at
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:196)
>   at
> org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec.unmarshal(JavaBinUpdateRequestCodec.java:131)
>    at
> org.apache.solr.handler.loader.JavabinLoader.parseAndLoadDocs(JavabinLoader.java:122)
>   at
> org.apache.solr.handler.loader.JavabinLoader.load(JavabinLoader.java:70)
>  at
> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:97)
>   at
> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:82)
>    at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216)
>   at org.apache.solr.core.SolrCore.execute(SolrCore.java:2637)    at
> org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:791)  at
> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:564)     at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427)
>    at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357)
>    at
> org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)   at
> org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
>   at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>   at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
>   at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
>   at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
>  at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
>    at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
>   at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
>   at
> org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
>    at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
>   at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>   at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)
> at
> org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)
>   at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
>   at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at
> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
>    at
> org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763)
>  at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:516)  at
> org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)
>  at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)  at
> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)    at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
> at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
> at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
>    at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
>  at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
>    at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
>   at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
>  at
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
>    at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
>   at java.base/java.lang.Thread.run(Thread.java:829)      at
> org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:681)
> at
> org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:266)
>   at
> org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248)
>   at
> org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:369)
> at
> org.apache.solr.client.solrj.impl.LBSolrClient.request(LBSolrClient.java:297)
>   at
> org.apache.solr.client.solrj.impl.BaseCloudSolrClient.lambda$directUpdate$0(BaseCloudSolrClient.java:555)
>   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>  at
> org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:218)
> ... 4 common frames omitted
>
> Thank you
>
> —
> Akhilesh K
> Blibli.com
>

Reply via email to