Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7896

Session state module with Tomcat 9.0.27 throws NullPointerException in setAttribute

    XMLWordPrintableJSON

Details

    Description

      Code like this:

      HttpSession session = request.getSession();
      session.setAttribute("key1", "value1");
      

      Causes this NPE in Tomcat 9.0.27:

      19-Mar-2020 16:05:13.874 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardHostValve.invoke Exception Processing /ExampleServlet
      	org.apache.geode.cache.client.ServerOperationException: remote server on boglesbymac(67921:loner):50955:e7c301f5: : While performing a remote put
      		at org.apache.geode.cache.client.internal.PutOp$PutOpImpl.processAck(PutOp.java:367)
      		at org.apache.geode.cache.client.internal.PutOp$PutOpImpl.processResponse(PutOp.java:270)
      		at org.apache.geode.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:207)
      		at org.apache.geode.cache.client.internal.AbstractOp.attempt(AbstractOp.java:382)
      		at org.apache.geode.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:266)
      		at org.apache.geode.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:352)
      		at org.apache.geode.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:750)
      		at org.apache.geode.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:138)
      		at org.apache.geode.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:108)
      		at org.apache.geode.cache.client.internal.PoolImpl.execute(PoolImpl.java:779)
      		at org.apache.geode.cache.client.internal.PutOp.execute(PutOp.java:91)
      		at org.apache.geode.cache.client.internal.ServerRegionProxy.put(ServerRegionProxy.java:159)
      		at org.apache.geode.internal.cache.LocalRegion.serverPut(LocalRegion.java:3037)
      		at org.apache.geode.internal.cache.LocalRegion.cacheWriteBeforePut(LocalRegion.java:3154)
      		at org.apache.geode.internal.cache.map.RegionMapPut.invokeCacheWriter(RegionMapPut.java:244)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutIfPreconditionsSatisified(AbstractRegionMapPut.java:295)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutOnSynchronizedRegionEntry(AbstractRegionMapPut.java:282)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutOnRegionEntryInMap(AbstractRegionMapPut.java:273)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.addRegionEntryToMapAndDoPut(AbstractRegionMapPut.java:251)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutRetryingIfNeeded(AbstractRegionMapPut.java:216)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doWithIndexInUpdateMode(AbstractRegionMapPut.java:198)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPut(AbstractRegionMapPut.java:180)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.runWhileLockedForCacheModification(AbstractRegionMapPut.java:119)
      		at org.apache.geode.internal.cache.map.RegionMapPut.runWhileLockedForCacheModification(RegionMapPut.java:161)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.put(AbstractRegionMapPut.java:169)
      		at org.apache.geode.internal.cache.AbstractRegionMap.basicPut(AbstractRegionMap.java:2044)
      		at org.apache.geode.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5602)
      		at org.apache.geode.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5580)
      		at org.apache.geode.internal.cache.LocalRegionDataView.putEntry(LocalRegionDataView.java:156)
      		at org.apache.geode.internal.cache.LocalRegion.basicPut(LocalRegion.java:5038)
      		at org.apache.geode.internal.cache.LocalRegion.validatedPut(LocalRegion.java:1637)
      		at org.apache.geode.internal.cache.LocalRegion.put(LocalRegion.java:1624)
      		at org.apache.geode.modules.session.catalina.DeltaSession.putInRegion(DeltaSession.java:430)
      		at org.apache.geode.modules.session.catalina.DeltaSession.commit(DeltaSession.java:451)
      		at org.apache.geode.modules.session.catalina.DeltaSessionFacade.commit(DeltaSessionFacade.java:36)
      		at org.apache.geode.modules.session.catalina.CommitSessionValve.invoke(CommitSessionValve.java:56)
      		at org.apache.geode.modules.session.catalina.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:45)
      		at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)
      		at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
      		at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      		at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
      		at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
      		at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
      		at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
      		at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      		at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
      		at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579)
      		at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      		at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      		at java.lang.Thread.run(Thread.java:745)
      	Caused by: java.lang.NullPointerException
      		at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1417)
      		at org.apache.geode.modules.session.catalina.DeltaSession.localUpdateAttribute(DeltaSession.java:369)
      		at org.apache.geode.modules.session.catalina.internal.DeltaSessionUpdateAttributeEvent.apply(DeltaSessionUpdateAttributeEvent.java:47)
      		at org.apache.geode.modules.session.catalina.DeltaSession.fromDelta(DeltaSession.java:515)
      		at org.apache.geode.internal.cache.EntryEventImpl.processDeltaBytes(EntryEventImpl.java:1839)
      		at org.apache.geode.internal.cache.EntryEventImpl.setNewValueInRegion(EntryEventImpl.java:1693)
      		at org.apache.geode.internal.cache.EntryEventImpl.putExistingEntry(EntryEventImpl.java:1640)
      		at org.apache.geode.internal.cache.map.RegionMapPut.updateEntry(RegionMapPut.java:485)
      		at org.apache.geode.internal.cache.map.RegionMapPut.createOrUpdateEntry(RegionMapPut.java:256)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutAndDeliverEvent(AbstractRegionMapPut.java:300)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.runWithIndexUpdatingInProgress(AbstractRegionMapPut.java:308)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutIfPreconditionsSatisified(AbstractRegionMapPut.java:296)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutOnSynchronizedRegionEntry(AbstractRegionMapPut.java:282)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutOnRegionEntryInMap(AbstractRegionMapPut.java:273)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.addRegionEntryToMapAndDoPut(AbstractRegionMapPut.java:251)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPutRetryingIfNeeded(AbstractRegionMapPut.java:216)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doWithIndexInUpdateMode(AbstractRegionMapPut.java:198)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.doPut(AbstractRegionMapPut.java:180)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.runWhileLockedForCacheModification(AbstractRegionMapPut.java:119)
      		at org.apache.geode.internal.cache.map.RegionMapPut.runWhileLockedForCacheModification(RegionMapPut.java:161)
      		at org.apache.geode.internal.cache.map.AbstractRegionMapPut.put(AbstractRegionMapPut.java:169)
      		at org.apache.geode.internal.cache.AbstractRegionMap.basicPut(AbstractRegionMap.java:2044)
      		at org.apache.geode.internal.cache.BucketRegion.virtualPut(BucketRegion.java:530)
      		at org.apache.geode.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5580)
      		at org.apache.geode.internal.cache.PartitionedRegionDataStore.putLocally(PartitionedRegionDataStore.java:1213)
      		at org.apache.geode.internal.cache.PartitionedRegion.putInBucket(PartitionedRegion.java:2999)
      		at org.apache.geode.internal.cache.PartitionedRegion.virtualPut(PartitionedRegion.java:2209)
      		at org.apache.geode.internal.cache.LocalRegionDataView.putEntry(LocalRegionDataView.java:170)
      		at org.apache.geode.internal.cache.LocalRegion.basicUpdate(LocalRegion.java:5573)
      		at org.apache.geode.internal.cache.LocalRegion.basicUpdate(LocalRegion.java:5533)
      		at org.apache.geode.internal.cache.LocalRegion.basicBridgePut(LocalRegion.java:5212)
      		at org.apache.geode.internal.cache.tier.sockets.command.Put65.cmdExecute(Put65.java:411)
      		at org.apache.geode.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:183)
      		at org.apache.geode.internal.cache.tier.sockets.ServerConnection.doNormalMessage(ServerConnection.java:848)
      		at org.apache.geode.internal.cache.tier.sockets.OriginalServerConnection.doOneMessage(OriginalServerConnection.java:72)
      		at org.apache.geode.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1212)
      		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      		at org.apache.geode.internal.cache.tier.sockets.AcceptorImpl.lambda$initializeServerConnectionThreadPool$3(AcceptorImpl.java:686)
      		at org.apache.geode.logging.internal.executors.LoggingThreadFactory.lambda$newThread$0(LoggingThreadFactory.java:119)
      

      DeltaSession.localUpdateAttribute does:

      super.setAttribute(name, value, false); // don't do notification since this is a replication
      

      StandardSession.java:1417 is:

      Context context = manager.getContext();
      

      The manager is null on the server.

      The StandardSession.setAttribute method does the same in 9.0.33. I'm not sure about versions prior to 9.0.27.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              boglesby Barrett Oglesby
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: