You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Session Replay: session segment ID can repeat after an error converts buffer mode #6740
add_frame removes expired buffered segments and does currentSegment--.
The capture_replay task then sends the current segment with the changed counter. After that, the callback does activeStrategy.currentSegment++ on the copy that is out of date.
Example
Buffer mode. No segments are buffered, so currentSegment is 0.
The user rotates the device. A configuration_changed task is in the queue.
An error occurs before that task runs. convert() starts the session with segment ID 0.
The configuration_changed task buffers segment 0. The buffer counter becomes 1.
The capture_replay task sends buffered segment 0 and current segment 1. The callback sets the session counter from 0 to 1.
The next session segment also has ID 1.
Proposed fix
Set the next session segment ID from the ID of the segment that the flush sent (for example, pass it to onSegmentSent and set currentSegment = sentId + 1). Do not increment a copy.
Add a test: a configuration_changed or pause task in the queue when an error converts the strategy. Then the session segment IDs must not repeat.
Found while reviewing #6542. That PR can also change the counter in a queued task (a clock jump deletes buffered segments). The bug is on main without it.
Activity
linear-code commentedon Nov 23, 2026
JAVA-853