Skip to content

Add bounds checking to Entry::current_running_duration#6643

Merged
stuhood merged 2 commits into
pantsbuild:masterfrom
twitter:stuhood/duration-bounds-check
Oct 17, 2018
Merged

Add bounds checking to Entry::current_running_duration#6643
stuhood merged 2 commits into
pantsbuild:masterfrom
twitter:stuhood/duration-bounds-check

Conversation

@stuhood

@stuhood stuhood commented Oct 17, 2018

Copy link
Copy Markdown
Member

Problem

As shown in #6640, once we moved Entry locks outside of the Graph lock in #6095, it became possible for heavy_hitters to race against Nodes that are starting outside of the Graph lock.

Solution

Add a bounds check for Instant::duration_since in current_running_duration, to handle the case where a Node is started after we begin computing heavy_hitters. While switching to Instant::elapsed would "mostly" avoid this case, it would incur additional syscalls, without fully avoiding panics.

Result

Fixes #6640.

… where a Node is started after we begin computing heavy_hitters.
@stuhood stuhood merged commit 02c68ac into pantsbuild:master Oct 17, 2018
@stuhood stuhood deleted the stuhood/duration-bounds-check branch October 17, 2018 17:27
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