Skip to content

fix(event): back-pressure realtime event loading instead of dropping#6818

Closed
xxo1shine wants to merge 1 commit into
tronprotocol:release_v4.8.2from
xxo1shine:fix/realtime-event-backpressure
Closed

fix(event): back-pressure realtime event loading instead of dropping#6818
xxo1shine wants to merge 1 commit into
tronprotocol:release_v4.8.2from
xxo1shine:fix/realtime-event-backpressure

Conversation

@xxo1shine
Copy link
Copy Markdown
Collaborator

What does this PR do?
When the realtime event queue was full (maxEventSize), RealtimeEventService.add silently dropped a whole block's realtime events while the solid path still delivered them from cache, causing realtime subscribers to miss events with no way to recover.

  • RealtimeEventService: add isBusy() (queue.size() >= maxEventSize) and remove the silent drop in add(); just offer to the queue.
  • BlockEventLoad: gate load() on realtimeEventService.isBusy() so loading pauses (non-blocking, outside the manager lock) when the realtime queue is full, instead of dropping events.

This keeps the realtime queue bounded (no OOM) and does not block block processing; loading resumes and re-derives events from db once the queue drains, so no events are lost.

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@github-actions github-actions Bot requested a review from 0xbigapple June 3, 2026 09:28
When the realtime event queue was full (maxEventSize), RealtimeEventService.add silently dropped a whole block's realtime events while the solid path still delivered them from cache, causing realtime subscribers to miss events with no way to recover.

- RealtimeEventService: add isBusy() (queue.size() >= maxEventSize) and remove the silent drop in add(); just offer to the queue.
- BlockEventLoad: gate load() on realtimeEventService.isBusy() so loading pauses (non-blocking, outside the manager lock) when the realtime queue is full, instead of dropping events.
- RealtimeEventServiceTest: cover isBusy() for both the not-busy and busy cases.

This keeps the realtime queue bounded (no OOM) and does not block block processing; loading resumes and re-derives events from db once the queue drains, so no events are lost.
@xxo1shine xxo1shine force-pushed the fix/realtime-event-backpressure branch from 2213edd to b4e01f0 Compare June 3, 2026 10:08
@halibobo1205 halibobo1205 added the topic:event subscribe transaction trigger, block trigger, contract event, contract log label Jun 3, 2026
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.8.2 milestone Jun 3, 2026
@xxo1shine xxo1shine closed this Jun 3, 2026
@halibobo1205 halibobo1205 removed this from the GreatVoyage-v4.8.2 milestone Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:event subscribe transaction trigger, block trigger, contract event, contract log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants