Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8303937: Corrupted heap dumps due to missing retries for os::write()
Reviewed-by: clanger
Backport-of: bf16b5b9880eb89b283006db090dce4346aa877b
  • Loading branch information
Man Cao authored and RealCLanger committed Mar 15, 2023
1 parent c6f0085 commit 97809af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hotspot/share/services/heapDumperCompression.cpp
Expand Up @@ -53,10 +53,14 @@ char const* FileWriter::write_buf(char* buf, ssize_t size) {
assert(_fd >= 0, "Must be open");
assert(size > 0, "Must write at least one byte");

ssize_t n = (ssize_t) os::write(_fd, buf, (uint) size);
while (size > 0) {
ssize_t n = os::write(_fd, buf, (uint) size);
if (n <= 0) {
return os::strerror(errno);
}

if (n <= 0) {
return os::strerror(errno);
buf += n;
size -= n;
}

return NULL;
Expand Down

1 comment on commit 97809af

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.