Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip ipc eof error on deserialize #160

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

mattsse
Copy link
Member

@mattsse mattsse commented Jan 29, 2024

The StreamSerializer returns an EOF error in some cases, I believe this happens if the last byte is a terminating byte " } ]

2024-01-29T13:20:01.196631Z ERROR alloy_transport_ipc: IPC response contained invalid JSON. Buffer contents will be logged at trace level e=EOF while parsing an object at line 1 column 674
2024-01-29T13:20:01.196647Z TRACE alloy_transport_ipc: IPC response contained invalid JSON. NOTE: Buffer contents do not include invalid utf8. buffer={"jsonrpc":"2.0","method":"eth_subscription","params":{"subscription":"0x3a5f25f7fe9d8c21cc1a34e941623c73","result":{"hash":"0x8f02502ae22a869f00d8faaf1038bd12ff1d19864e788b4fde44879ff13ff044","parentHash":"0xa831d7ab24f5808a43ecfb2dc0106ae3f46f95cd7093c8facf1532f0c8723a9e","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x9baa3244565d51d9c7897c0eb6679ed4890e536e","stateRoot":"0xa9b353aaf3436620e7056c64ecc8cc076d57ec9ea93d348d420a4bb5afc2df39","transactionsRoot":"0xfe76b1d908ed96e34dbdc1d5e10d0a9f697805953bc3a13f615bcb2173abeba0","receiptsRoot":"0x4d9961d09d691c4c0434f7e8bae0a2300609c76d89ad3a68c0d66074f70e74dc","logsBloom"
2024-01-29T13:20:01.197026Z ERROR alloy_transport_ipc: Read stream has failed.
2024-01-29T13:20:01.197111Z  INFO alloy_pubsub::service: Reconnecting pubsub service backend.

the StreamDeserializer::byte_offset docs mention

    /// Returns the number of bytes so far deserialized into a successful `T`.
    ///
    /// If a stream deserializer returns an EOF error, new data can be joined to
    /// `old_data[stream.byte_offset()..]` to try again.

adds an eof error check and treat it as None case

Copy link
Contributor

@Evalir Evalir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, this seems good to me. I'll defer to @prestwich for merge to have some more eyes

@mattsse mattsse merged commit 9f4edbe into main Jan 29, 2024
14 checks passed
@mattsse mattsse deleted the matt/skip-eof-deserde-error branch January 29, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants