LPS-30234 Prevent EOF race condition
LPS-30341 Unit test
LPS-30341 SF
LPS-35358  SF