Skip to content

fix(net): reduce memory usage in transaction queues - #100

Closed
317787106 wants to merge 1 commit into
release_v4.8.3from
fix/restrict_queue_memory
Closed

317787106 wants to merge 1 commit into
release_v4.8.3from
fix/restrict_queue_memory

Conversation

@317787106

@317787106 317787106 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Reduce memory retained by incoming transaction queues and avoid unnecessary serialization allocations in TransactionsMsgHandler.

  • Strip transaction-level unknown fields and redundant ret entries before admission. Both smart-contract events and ordinary transaction tasks retain the cleaned transaction.
  • Drop transactions whose serialized size still exceeds 500 KiB after cleanup, before either queue retains them.
  • Calculate transaction IDs through TransactionCapsule, avoiding the full transaction byte arrays created by temporary TransactionMessage objects during request checks and cleanup.

Why are these changes required?

Queued transactions could retain removable padding or oversized payloads until worker processing and downstream validation. During a backlog, these bytes accumulate in protobuf objects and, for smart-contract messages, cached serialized data. Cleaning and checking transactions before admission reduces this retained memory, while avoiding temporary message construction reduces allocation pressure.

The cleanup preserves signed raw_data and transaction IDs. The size check is an early admission guard; full transaction validation still runs downstream.

This PR has been tested by:

  • 25 targeted tests passed locally, including four new tests covering both transaction paths: padding removal, oversized payload rejection, the exact 500 KiB boundary, and redundant-result cleanup. Assertions also verify retained message bytes and transaction IDs.
  • checkstyleMain, checkstyleTest, and git diff --check passed.

@317787106 317787106 changed the title fix(net): drop oversized transaction and delete unknown fields of transaction fix(net): drop oversized tx and delete unknown fields of tx Oct 7, 2026
@317787106 317787106 changed the title fix(net): drop oversized tx and delete unknown fields of tx fix(net): reduce memory usage in transaction queues Oct 7, 2026
@317787106 317787106 closed this Oct 8, 2026
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.

1 participant