-
Notifications
You must be signed in to change notification settings - Fork 468
Description
Below are the contents of /proc/{pid}/stat
for two processes.
1981866 (python3) S 1981743 1981866 1981743 0 -1 1077936384 34709484 16140 105 0 72770 37613 11 9 20 0 17 0 372814758 4442140672 55046 18446744073709551615 94888328609792 94888328612516 140731140400576 0 0 0 0 16781312 17642 0 0 0 17 79 0 0 16 0 0 94888330710392 94888330711088 94888354955264 140731140409715 140731140409755 140731140409755 140731140415457 0
1984043 (probe(1981866)) S 1981866 1981866 1981743 0 -1 4194368 1324 0 0 0 169 99 0 0 20 0 3 0 372915682 4424044544 33799 18446744073709551615 94888328609792 94888328612516 140731140400576 0 0 0 0 16781312 17642 0 0 0 17 63 0 0 0 0 0 94888330710392 94888330711088 94888354955264 140731140409715 140731140409755 140731140409755 140731140415457 0
When we try to use py-spy dump --pid 1984043
, then we get the following error Error: Failed to parse /proc/1984043/stat
.
I think the problem should lie in the judgment of this code for the case of '))'
(in remoteprocess)
fn get_active_status(stat: &[u8]) -> Option<u8> {
// find the first ')' character, and return the active status
// field which comes after it
let mut iter = stat.iter().skip_while(|x| **x != b')');
match (iter.next(), iter.next(), iter.next()) {
(Some(b')'), Some(b' '), ret) => ret.map(|x| *x),
_ => None
}
}
I thought I'd make a note of the issue here, though I'm not very familiar with the code that actually executes in process 1984043, I will try to check this and if necessary I'd willing to fix it if I had time.