Skip to content

Exception handling and traces should be improved in the code path related to Forging process #349

@alsala

Description

@alsala

Currently, if anything wrong is happening when sending a websocket request to MC and processing the result, the only error indication explicitly written in the traces is a 'Connection Error', even in case of internal error.

For instance if the response got from the MC contains a block hex which can not be successfully parsed, we have an internal error which is not traced. The relevant method is:

MainchainNodeChannelImpl.processBlockResponsePayload

In ForgeMessageBuilder.tryToForgeNextBlock currently we have:

log.info(s"Forge result is: $result")

And the initial IllegalStateException exception details are lost:

[INFO ] 2022-04-01 12:07:59:496 +0000 [2-Hop-akka.actor.default-dispatcher-204188] com.horizen.forge.ForgeMessageBuilder - Forge result is: Failed block generation due java.lang.IllegalStateException: Can't retrieve MainchainBlockReference for hash ByteArrayWrapper[00006f8d2d5ce628381e965c0babddd01d73b41887399f4862a487baae4b817b]. Connection error.
[ERROR] 2022-04-01 12:07:59:503 +0000 [scala-execution-context-global-80] com.horizen.forge.Forger - Forging had been failed. Reason: Can't retrieve MainchainBlockReference for hash ByteArrayWrapper[00006f8d2d5ce628381e965c0babddd01d73b41887399f4862a487baae4b817b]. Connection error.

Moreover, some websocket tracing can be improved, for instance, in WebSocketConnectorImpl.sendMessage method, add debug info on what message is being processed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions