Skip to content

parsers: a single port's read error leaves the process serving 2/3 ports #32

Description

@armcconnell

Affects all three feed parsers: topofbook-parser, marketbyorder-parser, marketbyprice-parser.

Raised by @juan-malbeclabs in review of #29 (thread). Deliberately not fixed there, because fixing it in one module alone would fork the shutdown semantics from the other two.

Problem

Runner.Run spawns one goroutine per port and blocks on wg.Wait(). In receive, a non-timeout read error sends to errs and returns — exiting only that goroutine. The other two keep looping until the context is cancelled, so wg.Wait() never returns and Run never surfaces the error.

The process then stays up serving 2 of 3 ports indefinitely, with only a metric to show it. For marketbyprice-parser that means, for example, losing snapshot while mktdata keeps flowing, so a consumer can never resynchronize a gap instrument but sees no failure.

Fix

Cancel a shared context on the first fatal read error so the sibling goroutines wind down and Run returns the error to the caller, which already knows how to exit non-zero.

Should land as one change across all three parsers to keep their lifecycle behavior identical.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions