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
chore(profiling): fix flaky test_upload_resets_profile test (#15178)
## Description
Some tests try to read the newest profile and act on it. One such test,
`test_upload_resets_profile`, is flaky on MacOS (but strangely not on
Linux in the CI). It sometimes reads an empty profile (which is
expected), and sometimes does not (the empty-file assert is not
triggered and test fails).
The current way of finding the latest file in
`pprof_utils.parse_newest_profile` is error-prone because the latest
file `ctime`, metadata change time, is not always a true "latest" file;
this can happen for a variety of reasons, e.g. one file gets written
faster than the other one, because it's smaller ("empty").
_Example:_
* `file.foo.1` created at `t0` (sequence: 1)
* `file.foo.0` created at `t1` (sequence: 0)
Logically, `file_1` is the latest file, because that is the sequence
number assigned to it; however, currently we think it is `file_0` (t1 >
t0).
### What changed ###
* Instead of sorting by `ctime`, we sort by the "logical" time (i.e. the
file's seq_num)
## Testing
* multiple consecutive local runs on my Mac pass reliably (10+ tries)
0 commit comments