Skip to content

Commit c8ca570

Browse files
author
duke
committedFeb 25, 2022
Automatic merge of jdk:master into master
2 parents 634d53e + 9471f24 commit c8ca570

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed
 

‎src/hotspot/share/jfr/jni/jfrJavaSupport.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -554,14 +554,16 @@ void JfrJavaSupport::throw_runtime_exception(const char* message, TRAPS) {
554554

555555
void JfrJavaSupport::abort(jstring errorMsg, JavaThread* t) {
556556
DEBUG_ONLY(check_java_thread_in_vm(t));
557-
558557
ResourceMark rm(t);
559-
const char* const error_msg = c_str(errorMsg, t);
560-
if (error_msg != NULL) {
561-
log_error(jfr, system)("%s",error_msg);
558+
abort(c_str(errorMsg, t));
559+
}
560+
561+
void JfrJavaSupport::abort(const char* error_msg, bool dump_core /* true */) {
562+
if (error_msg != nullptr) {
563+
log_error(jfr, system)("%s", error_msg);
562564
}
563565
log_error(jfr, system)("%s", "An irrecoverable error in Jfr. Shutting down VM...");
564-
vm_abort();
566+
vm_abort(dump_core);
565567
}
566568

567569
JfrJavaSupport::CAUSE JfrJavaSupport::_cause = JfrJavaSupport::VM_ERROR;

‎src/hotspot/share/jfr/jni/jfrJavaSupport.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -101,6 +101,7 @@ class JfrJavaSupport : public AllStatic {
101101

102102
// critical
103103
static void abort(jstring errorMsg, TRAPS);
104+
static void abort(const char* error_msg, bool dump_core = true);
104105
static void uncaught_exception(jthrowable throwable, JavaThread* t);
105106

106107
// asserts

‎src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#ifndef SHARE_JFR_WRITERS_JFRSTREAMWRITERHOST_INLINE_HPP
2626
#define SHARE_JFR_WRITERS_JFRSTREAMWRITERHOST_INLINE_HPP
2727

28+
#include "jfr/jni/jfrJavaSupport.hpp"
2829
#include "jfr/writers/jfrStreamWriterHost.hpp"
29-
3030
#include "runtime/os.hpp"
3131

3232
template <typename Adapter, typename AP>
@@ -77,6 +77,9 @@ inline void StreamWriterHost<Adapter, AP>::write_bytes(const u1* buf, intptr_t l
7777
while (len > 0) {
7878
const unsigned int nBytes = len > INT_MAX ? INT_MAX : (unsigned int)len;
7979
const ssize_t num_written = os::write(_fd, buf, nBytes);
80+
if (errno == ENOSPC) {
81+
JfrJavaSupport::abort("Failed to write to jfr stream because no space left on device", false);
82+
}
8083
guarantee(num_written > 0, "Nothing got written, or os::write() failed");
8184
_stream_pos += num_written;
8285
len -= num_written;

0 commit comments

Comments
 (0)
Please sign in to comment.