mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
7007769: VM crashes with SIGBUS writing PerfData if tmp space is full
Fill perfdata file with zeros to verify available disk space Reviewed-by: coleenp, kamg
This commit is contained in:
parent
2540ccd05f
commit
178b7bb4c1
1 changed files with 23 additions and 1 deletions
|
@ -635,7 +635,29 @@ static int create_sharedmem_resources(const char* dirname, const char* filename,
|
|||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
// Verify that we have enough disk space for this file.
|
||||
// We'll get random SIGBUS crashes on memory accesses if
|
||||
// we don't.
|
||||
|
||||
for (size_t seekpos = 0; seekpos < size; seekpos += os::vm_page_size()) {
|
||||
int zero_int = 0;
|
||||
result = (int)os::seek_to_file_offset(fd, (jlong)(seekpos));
|
||||
if (result == -1 ) break;
|
||||
RESTARTABLE(::write(fd, &zero_int, 1), result);
|
||||
if (result != 1) {
|
||||
if (errno == ENOSPC) {
|
||||
warning("Insufficient space for shared memory file:\n %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != -1) {
|
||||
return fd;
|
||||
} else {
|
||||
RESTARTABLE(::close(fd), result);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// open the shared memory file for the given user and vmid. returns
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue