apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store
https://apple.github.io/foundationdb/
Apache License 2.0
14.33k stars 1.3k forks source link

Capturing forked process output unintentionally violates assertions in certain situations #4514

Closed sfc-gh-jfu closed 2 years ago

sfc-gh-jfu commented 3 years ago

https://github.com/apple/foundationdb/pull/4254/ In the spawnProcess function, there is a loop that reads bytes read from readFD, but sometimes the number of bytes given is a ridiculously large amount (> 10^18), which causes a failed assertion further down the line in setupTraceWithOutput. This seems like there may be an issue in attempting to read the number of bytes before the child process has completed. However, there are also situations where traces want to use the bytesRead before the child process completes, or if it fails to complete at all. This will likely require some refactoring of this code path.

sfc-gh-tclinkenbeard commented 2 years ago

This is fixed by #5672.