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

Refuse splicing the live timeline into a broken position #873

Merged
merged 4 commits into from
Mar 29, 2019

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Mar 29, 2019

Credit to Matthew for basically solving this.

Theoretically fixes spontaneous timeline corruption: element-hq/element-web#8593

When the live timeline ends up in a position where it can no longer be live (such as becoming the second timeline in the set, rather than the first) we end up getting neighbouring timeline errors. By refusing to splice the live timeline into such a position, we hopefully keep the live timeline in a position of still being live for when it is next used.

The running theory that leads to this fix is multiple limited syncs coming in, causing holes in the timeline. When trying to patch up the holes, the timeline set would end up splicing all over the place, leading to potentially splicing the live timeline into a broken position.

Disclaimer: I've done light testing on Riot to make sure it doesn't fail in miserable ways, but have not reproduced the case which causes the issue in the first place. The issue is a bit complex to test, hence the word "theory" being littered above.

Credit to Matthew for basically solving this.

Theoretically fixes spontaneous timeline corruption: element-hq/element-web#8593

When the live timeline ends up in a position where it can no longer be live (such as becoming the second timeline in the set, rather than the first) we end up getting neighbouring timeline errors. By refusing to splice the live timeline into such a position, we hopefully keep the live timeline in a position of still being live for when it is next used.

The running theory that leads to this fix is multiple limited syncs coming in, causing holes in the timeline. When trying to patch up the holes, the timeline set would end up splicing all over the place, leading to potentially splicing the live timeline into a broken position.
@turt2live turt2live requested a review from a team March 29, 2019 00:35
@@ -408,8 +408,21 @@ EventTimelineSet.prototype.addEventsToTimeline = function(events, toStartOfTimel
console.info("Already have timeline for " + eventId +
" - joining timeline " + timeline + " to " +
existingTimeline);
timeline.setNeighbouringTimeline(existingTimeline, direction);
existingTimeline.setNeighbouringTimeline(timeline, inverseDirection);

Copy link
Member

Choose a reason for hiding this comment

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

the warnings are a bit cryptic here, to the point of being very confusing for the 2nd one. how about:

"Refusing to set a preceding existingTimeLine on our timeline as the existingTimeLine is live"
and
"Refusing to set our preceding timeline on a existingTimeLine as our timeline is live"
perhaps?

@turt2live turt2live requested a review from ara4n March 29, 2019 00:59
@ara4n
Copy link
Member

ara4n commented Mar 29, 2019

lgtm. only other change would be to log the timeline ids so we can do forensics later

@turt2live turt2live merged commit eab074a into develop Mar 29, 2019
@turt2live turt2live deleted the travis/refuse-splicing branch March 29, 2019 01:21
turt2live added a commit that referenced this pull request Apr 2, 2019
See element-hq/element-web#8593 (comment)

Previously (#873) we allowed half-linking timelines to each other if they satisfy the conditions, however this appears to not be helping. Instead, it seems like the timelines are getting stuck in a position where one direction is spliced but the other is broken. To avoid this case, we'll just avoid splicing in both directions when one of the directions is invalid.
bwindels pushed a commit that referenced this pull request Apr 8, 2019
See element-hq/element-web#8593 (comment)

Previously (#873) we allowed half-linking timelines to each other if they satisfy the conditions, however this appears to not be helping. Instead, it seems like the timelines are getting stuck in a position where one direction is spliced but the other is broken. To avoid this case, we'll just avoid splicing in both directions when one of the directions is invalid.
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.

2 participants