Cardano-node: Negative diff time from block time

Created on 12 Nov 2019  路  4Comments  路  Source: input-output-hk/cardano-node

When cardano-node [1] is launched prior to the genesis systemStart, the node crashes in https://github.com/input-output-hk/ouroboros-network/blob/master/io-sim-classes/src/Control/Monad/Class/MonadTimer.hs#L190

Tracing io-sim-classes shows, that:

  1. The values immediately at the point of crash are: d=368934881474191032325.522370163s, usec=368934881474191032325522370, maxBound=9223372036854775807, fromIntegral (maxBound :: Int)=9223372036854775807
  2. HasCallStack shows that threadDelay is the immediate caller of diffTimeToMicrosecondsAsInt

--

  1. cardano-node commit c8c498de0129d54f264fd8b7a92a7d0b5677f662
bug

Most helpful comment

@deepfire: @edsko and I decided the following:

This is indeed a "bug", but not a critical one, as the real systemStart is in the past, so for the real nodes, this won't be a problem. However, we should throw a proper exception so that developers testing with a systemStart in the future at least know what's going wrong: https://github.com/input-output-hk/ouroboros-network/issues/1218.
In the future, we plan to handle this by blocking the time until the systemStart has come https://github.com/input-output-hk/ouroboros-network/issues/1219 (low priority enhancement).

All 4 comments

cc @dcoutts, @mrBliss.

The call stack (courtesy of @deepfire):
realBlockchainTime, waitUntilNextSlotIO, timeUntilNextSlot, slotAtTime.

What should happen when launched at a time before the systemStart defined in the genesis config? The blockchain time should wait until the systemStart before starting to "tick" the slots.

@deepfire: @edsko and I decided the following:

This is indeed a "bug", but not a critical one, as the real systemStart is in the past, so for the real nodes, this won't be a problem. However, we should throw a proper exception so that developers testing with a systemStart in the future at least know what's going wrong: https://github.com/input-output-hk/ouroboros-network/issues/1218.
In the future, we plan to handle this by blocking the time until the systemStart has come https://github.com/input-output-hk/ouroboros-network/issues/1219 (low priority enhancement).

I've seen plenty of evidence that the recent cardano-node can be started prior to genesis-inscribed systemStart.

:heart:

Was this page helpful?
0 / 5 - 0 ratings