Ticket #297 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

RoboBots crashed on !smodlock

Reported by: Maverick Owned by: milosh
Priority: low Component: Bots - Multibot
Version: Latest version from repository Severity: minor
Keywords: !smodlock, crash, multibot, robobot Cc:

Description

The RoboBots were !smodlock'ed for a day yesterday but today I wanted to unlock them using !smodlock again but they (not all robobots though) crashed right after issuing the command.

java.lang.NullPointerException
        at twcore.core.BotAction.sendPrivateMessage(Unknown Source)
        at twcore.core.BotAction.sendSmartPrivateMessage(Unknown Source)
        at twcore.core.BotAction.sendSmartPrivateMessage(Unknown Source)
        at twcore.bots.multibot.multibot.handleCommands(multibot.java:279)
        at twcore.bots.multibot.multibot.handleEvent(multibot.java:150)
        at twcore.core.net.GamePacketInterpreter.handleChatMessage(Unknown Source)
        at twcore.core.net.GamePacketInterpreter.translateNormalPacket(Unknown Source)
        at twcore.core.net.GamePacketInterpreter.translateGamePacket(Unknown Source)
        at twcore.core.net.ReliablePacketHandler.handleReliableMessage(Unknown Source)
        at twcore.core.net.GamePacketInterpreter.translateSpecialPacket(Unknown Source)
        at twcore.core.net.GamePacketInterpreter.translateGamePacket(Unknown Source)
        at twcore.core.Session.run(Unknown Source)

I checked the code and I'm fairly certain the line if(m_twScript.ACCESS_LEVEL == TWScript.SMOD_LEVEL){ causes it but I don't know what it does exactly.

Can you take a look into this, milosh?

Attachments

Change History

in reply to: ↑ 1   Changed 2 years ago by Maverick

If you're wondering why there are no line numbers in the stack trace (as I was), it's because the code was in the compiled jar file and that code has been precompiled to bytecode by the JIT compiler.

More information here.

  Changed 2 years ago by milosh

Well I don't completely understand it even after reading that, but I'm sure the exception itself has to do with it. That line through an NPE because its accessing a common object. All of the TWScript utilities access the same TWScript object which initializes on instantiation, so I can say that it's reasonable to assume that JIT is responsible. I'm not available to investigate this right now though.

follow-up: ↓ 8   Changed 2 years ago by Ayano

It's an NPE from what I see of it, 'm_twScript.ACCESS_LEVEL' is the culprit.

m_twScript is a private twscript that is only initialized when loading the twscript module. The doSmodLock and doSysopLock use m_twScript regardless wither it was initialized or not. So if this was sent to robobots that haven't already loaded twscript, it would 'lock' as the !m_sysoplock /!m_smodlock doesn't check m_twscript. Upon unlocking it, it would crash as it does check m_twscript, and if it's not initialized, NPE.

<code>

java.lang.NullPointerException

at twcore.core.BotAction.sendPrivateMessage(BotAction.java:439)
at twcore.core.BotAction.sendSmartPrivateMessage(BotAction.java:494)
at twcore.core.BotAction.sendSmartPrivateMessage(BotAction.java:463)
at twcore.bots.multibot.multibot.handleCommands(multibot.java:279)
at twcore.bots.multibot.multibot.handleEvent(multibot.java:144)
at twcore.core.net.GamePacketInterpreter.handleChatMessage(GamePacketInterpreter.java:450)
at twcore.core.net.GamePacketInterpreter.translateNormalPacket(GamePacketInterpreter.java:165)
at twcore.core.net.GamePacketInterpreter.translateGamePacket(GamePacketInterpreter.java:113)
at twcore.core.net.ReliablePacketHandler.handleReliableMessage(ReliablePacketHandler.java:88)
at twcore.core.net.GamePacketInterpreter.translateSpecialPacket(GamePacketInterpreter.java:292)
at twcore.core.net.GamePacketInterpreter.translateGamePacket(GamePacketInterpreter.java:111)
at twcore.core.Session.run(Session.java:350)

</code>

voila, same error. Btw, can some tell me how you insert code braces?

  Changed 2 years ago by milosh

Yeah, my bad... I don't really feel like fixing it. My girlfriend just dumped me.

  Changed 2 years ago by milosh

  • status changed from new to closed
  • resolution set to fixed

Nevermind. Changeset: 2805

  Changed 2 years ago by Maverick

Haha nice!
I was just going to say not to worry about it ;)

Thanks milosh

in reply to: ↑ 4   Changed 2 years ago by Maverick

Replying to Ayano:

voila, same error. Btw, can some tell me how you insert code braces?

Start with { { { and end with } } }, see WikiFormatting for more information.

Add/Change #297 (RoboBots crashed on !smodlock)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.