OnixS ICE iMpact Multicast Price Feed Handler C++ library 8.20.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Error Handling And Recovery

Error Handling Concept

As a C++ class library, the Handler uses exceptions to report errors that occur while performing an action. For example, the Handler raises a regular exception to report the inability to connect to the Multicast Price Feed server or a failure in the login procedure. However, once a subscription to market data succeeds, the Handler cannot report any further errors because it performs all handling asynchronously in the background. For this reason, the Handler exposes the ErrorListener interface and Handler::registerErrorListener member so you can subscribe to and handle errors.

Once an instance of ErrorListener is assigned to the Handler, it invokes the ErrorListener::onError member each time an error occurs. ErrorListener::onError has two input parameters that define the error code (identifier) and a human-readable description of the error.

The KnownErrors type contains constants and descriptions for errors that may occur while processing market data from Multicast Price Feed.

  • Nothing This indicates that no error has occurred. Default value.
  • Generic A general, non-specific error occurred. This could be due to various reasons such as unexpected conditions or unknown issues in the system.
  • NotLicensed This error occurs when no valid license is available, or the license has expired.
  • BadConfiguration The Handler's configuration settings are incorrect or incomplete. This might include invalid parameters or missing required fields.
  • BadPacket The network packet received by the Handler is corrupted, possibly due to transmission errors, network issues, or interference during data transfer.
  • BadMessage The message structure is invalid, possibly due to a malformed format, missing fields, or unexpected values.
  • MarketTypeIsNotPermitted Signals an attempt to subscribe to a market type that is not allowed for the user's credentials.
  • LogReplayFailure The system encountered an irrecoverable error while attempting to replay logs. This could be due to corrupted or missing log files, or hardware failures.
  • LoginFailure The ICE login attempt was unsuccessful. This could be due to incorrect login credentials or issues with the authentication server.

An important aspect of the Handler's behavior is that, in the usual case, there is nothing specific you must do about errors. Once a market data subscription starts successfully, the Handler processes incoming data and handles failures on its own without further action. You do not need to restart the subscription manually. The Handler performs error recovery optimally. For example, for network-related problems, it rebuilds only the books and market states that depend on the problematic Multicast Price Feed channel. It does not invalidate and rebuild the entire subscription.

See the Event Listeners topic for more information on how to subscribe to a particular event.

Failure Recovery

The Handler is able to recover the market state for all the product definitions from requested market subscriptions in case some packets are lost. All the logic is implemented according to 5.2. Synchronization with Live Updates of the official ICE iMpact Multicast Feed Technical Specification.

In general, users don't need to do anything to handle missing packets, as the Handler will start the recovery procedure and reconstruct the books automatically. The recovery follows this sequence:

  1. A sequence gap is detected (governed by sequenceGapMargin and gapTimeoutInMilliseconds).
  2. TCP Historical Replay is attempted (if enabled) on a live update channel. ICE does not provide it for snapshot channels, so a gap there goes straight to snapshot recovery. ICE does not guarantee retransmission availability - if the server returns "Sequence Number(s) not available", the request is not retried.
  3. If Historical Replay is unavailable or fails, the Handler falls back to snapshot recovery using snapshot multicast channels.

If you want to tune the snapshot recovery process, use the SnapshotRecoveryOptions structure. It controls how long the Handler waits for snapshots (snapshotRecoveryTimeoutInMilliseconds), how many recovery attempts it makes (maximumNumberOfSnapshotRecoveryAttempts), and the sizes of the packet queues used during recovery (maximumSizeOfLiveMessageQueue and maximumSizeOfSnapshotMessageQueue). See the API reference for the exact accepted values and defaults of each member.

The two queue-size settings are the ones relevant to PacketQueueOverflow. While recovery is in progress the Handler buffers packets in these queues, and when more arrive than the configured limit allows, the oldest are discarded and the warning is raised. For sizing guidance on these limits, see Warning Handling.

To reduce the risk of unnecessary delay caused by unavailable Historical Replay, consider lowering sequenceGapMargin and gapTimeoutInMilliseconds so that the Handler detects gaps early and reaches snapshot recovery sooner. Note that entering snapshot recovery is also what activates the packet queues (the inline Historical Replay path does not), so detecting gaps more aggressively makes recovery windows more frequent; if you tune these down, keep an eye on PacketQueueOverflow and size the queues accordingly. See also the lost multicast packets troubleshooting guide for advice on reducing UDP packet loss at the network level.

Sequence ID Rollover

A sequence number is an unsigned 32-bit value, so a busy channel eventually reaches its largest value, 4,294,967,295. The exchange announces that with a Sequence ID Rollover Message, published as the last message of the block that reaches the maximum. The next packet on that channel arrives with the session number incremented by one and the sequence number restarted at 1. The exchange rolls the corresponding snapshot channel over at the same time; the Handler needs nothing from it, because a snapshot feed is stopped and reset between recoveries and adopts whatever session arrives next.

No market data is lost at a rollover, so the Handler does not treat it as a new session: the order books are kept, no snapshot recovery is requested and no packet gap is reported. Subscribe to ExchangeListener::onSequenceIdRollover to be notified when one happens. The event is informational, and the MessageInfo it carries describes the block the message arrived in - so MessageInfo::sessionNumber reports the session that is ending, not the one that follows.

The Handler falls back to its ordinary session number change handling - reporting FeedListener::onSessionNumberChange and restarting - whenever the transition does not match the announcement exactly:

  • the rollover message itself was lost;
  • the session number skips rather than advancing by one;
  • the sequence number does not restart at 1;
  • the feed went quiet long enough to raise NoNetworkActivity, which retires the announcement;
  • a recovery was in flight. While the Handler is rebuilding its books from a snapshot it queues live messages, and the seamless path is deliberately not taken in that window. This is the fallback a user is most likely to meet, because it depends on what the Handler happened to be doing rather than on what the exchange sent.

NIC-Level Failover

The Handler does not implement automatic failover between network interface cards (NICs). If the NIC used for multicast reception stops working, the Handler will not switch to a second NIC automatically.

NIC-Level Redundancy

The Handler supports simultaneous reception on multiple NICs. Set HandlerSettings::networkInterface to a comma-delimited list of interface names (Linux) or IP addresses (Windows). The Handler joins each multicast group on all listed interfaces, so packets arriving on any of them are received on the same socket at the same time. Duplicate packets carrying the same sequence numbers from multiple NICs are discarded transparently by the existing sequence deduplication logic. The one exception is empty message blocks with HandlerSettings::notifyOnEmptyMulticastMessageBlocks enabled: the Handler reports each copy that reaches it rather than deduplicating them. See Empty Multicast Message Blocks.

This provides packet-level redundancy: a packet missed on one NIC may still be received on another, reducing the chance of a sequence gap.