Repository navigation
Conversation
Amp sends FlightData frames with an empty data header as keep-alives on long-lived streams. streamQuery read every frame's header as a flatbuffer, so the first keep-alive killed the stream with a RangeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On long-lived streams, Amp sends a keep-alive every
keep_alive_interval(30 seconds by default): an emptyFlightDatawith nodata_header.streamQueryread every frame's header as a flatbuffer, so the first keep-alive killed the stream. It now skips frames with an emptydata_header, the same check Amp's Rust client (amp-client-flight) makes indecode_flight_data.streamQuerywithstream: true, and soProtocolStream,TransactionalStreamandCdcStream, died 30 seconds in with a defect:RangeError: Offset is outside the bounds of the DataView. Busy streams too, since Amp sends the keep-alives on a fixed interval.I reproduced it with ampd v0.0.42 (
ampd solo) over an Anvil chain with 2-second blocks:streamQuery('SELECT block_num FROM "_/anvil".blocks', { stream: true })got a frame every 2 seconds, then died at 30 seconds with thatRangeError. With the fix, it streamed past both keep-alives (30 and 60 seconds) with no gaps in the block numbers.You might prefer checking
dataBodytoo (dataHeader.length === 0 && dataBody.length === 0). I only check the header, like the Rust client.Checks:
pnpm lint,pnpm check:tsgo,pnpm test(234 passed, 1 new) andpnpm circularpass.RangeError.See edgeandnode/amp#2661 for the keep-alive frames on Amp's side.
🤖 Generated with Claude Code