rr-debugger / rr-debugger/rr

clock_gettime(CLOCK_MONOTONIC, &ts) returns unexpected timestamp

Open
#3,443 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

During recording, I observed that the system monotonic clock may return strange values. In particular, the timestamp ts returned by clock_gettime(CLOCK_MONOTONIC, &ts) may be 0. This is rather unexpected and software relying on monotonic behavior might behave weird.
When replaying the trace, I see 2 threads calling clock_gettime simultaneously. Thread T1 gets interrupted during its call to clock_gettime. T2 is scheduled and returns a sensible value. T1 resumes and returns a timestamp of 0.
I'm not familiar with the rr code base, maybe the above information is sufficient to identify the problem. I build rr from source on commit 97997c263ad82c76f5705fb6b2f0e45de417b085.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided recording and replay scenario from commit 97997c263ad82c76f5705fb6b2f0e45de417b085, focusing on simultaneous clock_gettime(CLOCK_MONOTONIC, &ts) calls and the interrupted T1 thread. Trace the relevant rr handling until the zero timestamp is explained; done means the replay no longer returns 0 and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.