Skip to content

Commit baa407d

Browse files
committed
sdk/rust: Fix pwrite to flushing buffer before returning
Let's call flush() after write_all() to be safe. It's unclear to me if this explains a hostfs test failure I saw, but Tokio's documentation suggests that a write_all() returns when the write is handed over to the thread pool, but makes no guarantees that the write actually is done, meaning a subsequent read might return state data.
1 parent e62c4f1 commit baa407d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

sdk/rust/src/filesystem/hostfs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl FileSystem for HostFS {
131131

132132
file.seek(std::io::SeekFrom::Start(offset)).await?;
133133
file.write_all(data).await?;
134+
file.flush().await?;
134135
Ok(())
135136
}
136137

0 commit comments

Comments
 (0)