[keycloak-user] NPE in SegmentKeyTracker.track method

Nicolas Ocquidant nocquidant at gmail.com
Thu Nov 22 03:17:13 EST 2018


Hi

Still trying to start KC with millions of sessions in my JDBC store (remote
cache):
http://lists.jboss.org/pipermail/keycloak-user/2018-November/016393.html

So now, and after the patch made by William Burns, no more OOM, see
https://issues.jboss.org/browse/ISPN-9752

But then, I got the following exception during startup, see below. Note,
there is a TODO in the code:

public boolean track(byte[] key, short status, ClassWhiteList whitelist) {
   int segment = HotRodConstants.hasCompatibility(status) ?
         segmentConsistentHash.getSegment(dataFormat.keyToObj(key,
status, whitelist)) :
         segmentConsistentHash.getSegment(key);
   Set<WrappedByteArray> keys = keysPerSegment.get(segment);
   // TODO: this assertion may fail due to ISPN
   assert keys != null : "Segment " + segment + " not initialized,
tracking key " + Util.toStr(key);
   boolean result = keys.add(new WrappedByteArray(key));
   if (trace)
      log.trackingSegmentKey(Util.printArray(key), segment, !result);
   return result;
}

Do I have a workaround?
Thanks
--nick

22:35:55,749 WARN
[org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator]
(pool-16-thread-3) Error reaching the server during iteration:
org.infinispan.client.hotrod.exceptions.TransportException::
java.lang.NullPointerException
        at org.infinispan.client.hotrod.impl.Util.rewrap(Util.java:54)
        at org.infinispan.client.hotrod.impl.Util.await(Util.java:27)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.fetch(RemoteCloseableIterator.java:117)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.fetch(RemoteCloseableIterator.java:131)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.fetch(RemoteCloseableIterator.java:131)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.fetch(RemoteCloseableIterator.java:131)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.fetch(RemoteCloseableIterator.java:131)
        at
org.infinispan.client.hotrod.impl.iteration.RemoteCloseableIterator.hasNext(RemoteCloseableIterator.java:99)
        at
org.keycloak.models.sessions.infinispan.remotestore.RemoteCacheSessionsLoader.loadSessions(RemoteCacheSessionsLoader.java:108)
        at
org.keycloak.models.sessions.infinispan.remotestore.RemoteCacheSessionsLoader.loadSessions(RemoteCacheSessionsLoader.java:45)
        at
org.keycloak.models.sessions.infinispan.initializer.SessionInitializerWorker$1.run(SessionInitializerWorker.java:71)
        at
org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:228)
        at
org.keycloak.models.sessions.infinispan.initializer.SessionInitializerWorker.call(SessionInitializerWorker.java:67)
        at
org.keycloak.models.sessions.infinispan.initializer.SessionInitializerWorker.call(SessionInitializerWorker.java:34)
        at
org.infinispan.commands.read.DistributedExecuteCommand.invokeAsync(DistributedExecuteCommand.java:99)
        at
org.infinispan.distexec.DefaultExecutorService$LocalDistributedTaskPart.lambda$execute$1(DefaultExecutorService.java:1060)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
        at
org.infinispan.client.hotrod.impl.iteration.SegmentKeyTracker.track(SegmentKeyTracker.java:50)
        at
org.infinispan.client.hotrod.impl.operations.IterationNextOperation.acceptResponse(IterationNextOperation.java:111)
        at
org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.decode(HeaderDecoder.java:144)
        at
org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.callDecode(HintedReplayingDecoder.java:98)
        at
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at
io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582)
        at
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)
        at
io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
        ... 3 more


More information about the keycloak-user mailing list