CommandHelper

CommandHelper

46.5k Downloads

Vague Redis problem resulting in a ArrayIndexOutOfBoundsException.

LadyCailinBot opened this issue ยท 1 comments

commented

CMDHELPER-2827 - Reported by CyaNox

I am not entirely sure why this happened but the code it is referring to is the following:

  bind('comm_received', array(priority: 'high'), array(channel: 'intercomportmap'), @e,
    @serv = @e['publisherid']
    _log('Portmapping request received from: ' . @serv . ' ...')
    @servport = get_value('redis.portmap.' . @serv) # @@@ Line that produced the error @@@
    @lastport = get_value('redis.portmap.lastport')
    if (@lastport == null || @lastport <= 55000){
      @lastport = 55000
      store_value('redis.portmap.lastport', @lastport)
    }
    if (@servport == null || @servport <= 55000){
      @lastport++
      @servport = @lastport 
      store_value('redis.portmap.lastport', @lastport)
      store_value('redis.portmap.' . @serv, @lastport)
      _log('Assigned new port for: ' . @serv . ' being: ' . @lastport)
    }else{
      _log('Port already known for ' . @serv . ' being: ' . @servport)
    }
    consume()
  )

This code worked perfectly fine before (though with a different key name (survival)) and worked fine once I restarted the server so I'm not sure if this code has any use in the debugging process at all.

The key in question was not in the database (checked with redis-cli) but that normally is not a problem.

I was unable to reproduce this error but maybe the trace could still show faulty code or potentially better error handling.

{code:title=console}
16:51:54 [SEVERE] Uh oh! You've found an error in CommandHelper. This is an error caused by your code, so you may be able to find a workaround, but is ultimately an error in CommandHelper itself. The line of code that caused the error was this:
get_value('redis.portmap.void')
on or around /srv/mc/live/hub/plugins/CommandHelper/LocalPackages/shared/InterCom/InterCom.Internal.inc.ms:14.
Please report this error to the developers, and be sure to include the version numbers: Server version: 1.6.4-R2.1-SNAPSHOT; CommandHelper version: 3.3.1-SNAPSHOT:2441-6efae7b,master. Here's the stacktrace:
java.lang.ArrayIndexOutOfBoundsException: 8553
at com.laytonsmith.libs.redis.clients.util.RedisOutputStream.write(RedisOutputStream.java:35)
at com.laytonsmith.libs.redis.clients.jedis.Protocol.sendCommand(Protocol.java:39)
at com.laytonsmith.libs.redis.clients.jedis.Protocol.sendCommand(Protocol.java:33)
at com.laytonsmith.libs.redis.clients.jedis.Connection.sendCommand(Connection.java:80)
at com.laytonsmith.libs.redis.clients.jedis.Connection.sendCommand(Connection.java:75)
at com.laytonsmith.libs.redis.clients.jedis.Jedis.get(Jedis.java:66)
at com.laytonsmith.persistance.RedisDataSource.get0(RedisDataSource.java:109)
at com.laytonsmith.persistance.AbstractDataSource.get(AbstractDataSource.java:68)
at com.laytonsmith.persistance.PersistanceNetwork.get(PersistanceNetwork.java:110)
at com.laytonsmith.core.functions.Persistance$get_value.exec(Persistance.java:151)
at com.laytonsmith.core.Script.eval(Script.java:310)
at com.laytonsmith.core.Script.eval(Script.java:272)
at com.laytonsmith.core.Script.seval(Script.java:210)
at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:388)
at com.laytonsmith.core.Script.eval(Script.java:262)
at com.laytonsmith.core.Script.eval(Script.java:272)
at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
at com.laytonsmith.core.Script.eval(Script.java:262)
at com.laytonsmith.core.Procedure.execute(Procedure.java:191)
at com.laytonsmith.core.Procedure.cexecute(Procedure.java:149)
at com.laytonsmith.core.Script.eval(Script.java:239)
at com.laytonsmith.core.Script.eval(Script.java:272)
at com.laytonsmith.core.Script.eval(Script.java:272)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1494)
at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
at com.laytonsmith.core.Script.run(Script.java:164)
at com.laytonsmith.core.events.AbstractEvent.execute(AbstractEvent.java:73)
at com.laytonsmith.core.events.BoundEvent.execute(BoundEvent.java:305)
at com.laytonsmith.core.events.BoundEvent.trigger(BoundEvent.java:262)
at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:205)
at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193)
at com.laytonsmith.extensions.chsc.Events$1.run(Events.java:33)
at com.laytonsmith.abstraction.bukkit.BukkitConvertor$1.call(BukkitConvertor.java:392)
at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftFuture.run(CraftFuture.java:89)
at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345)
at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:530)
at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:240)
at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:493)
at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:425)
at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)

commented

Comment by LadyCailin

This actually looks like a bug in the Jedis library. There is nothing in the docs that specify this should happen, and actually, after digging into their library itself, it's a completely unexpected exception. Since it only happened once, I'm going to close this bug and assume it was a fluke, but if it happens again, let me know, and I'll see about getting up with the author of the Jedis library.