Skip to content

Exception stack log when processing transaction message #6178

@fyyhtx

Description

@fyyhtx

Software Versions

OS: Linux
JVM: Oracle Corporation 1.8.0_161 AMD64
Git: a8ad2a169e58946b5b8de6ecf7b7ef5b8db05aff
Version: 4.7.5
Code: 18306

Expected behaviour

The P2P module handles exceptions normally when processing transaction messages.

Actual behaviour

The mainnet fullnode I was running printed the following exception stack log:

java.lang.IndexOutOfBoundsException: Index: 0
at org.tron.protos.Protocol$Transaction$raw.getContract(Protocol.java:37837)
at org.tron.core.net.messagehandler.TransactionsMsgHandler.processMessage(TransactionsMsgHandler.java:74)
at org.tron.core.net.P2pEventHandlerImpl.processMessage(P2pEventHandlerImpl.java:201)
at org.tron.core.net.P2pEventHandlerImpl.onMessage(P2pEventHandlerImpl.java:141)
at org.tron.p2p.connection.ChannelManager.handMessage(ChannelManager.java:261)
at org.tron.p2p.connection.ChannelManager.processMessage(ChannelManager.java:207)
at org.tron.p2p.connection.socket.MessageHandler.decode(MessageHandler.java:51)
at org.tron.p2p.stats.TrafficStats$TrafficStatHandler.channelRead(TrafficStats.java:36)

After analyzing the code, we found that the location of the exception log output is the TransactionsMsgHandler class that processes transaction messages. By default, each transaction carried by the transaction message in the processing logic contains at least 1 contract. Suppose the transaction received from the peer does not carry a contract. In that case, an IndexOutOfBoundsException exception will be reported when processing this transaction, and the connection with the peer will be disconnected.

Frequency

The exception stack appears occasionally.

Steps to reproduce the behaviour

Send transaction P2P messages without contracts to the node.

Backtrace

[backtrace]

When submitting logs: please submit them as text and not screenshots.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions