From 55f4786e9f9663df623fd0a885491e3013bdefc6 Mon Sep 17 00:00:00 2001 From: Benshuai5D Date: Sat, 17 May 2025 11:04:20 +0800 Subject: [PATCH] add heapdump-bug-fix.patch --- heapdump-bug-fix.patch | 66 ++++++++++++++++++++++++++++++++++++++++++ openjdk-1.8.0.spec | 10 ++++++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 heapdump-bug-fix.patch diff --git a/heapdump-bug-fix.patch b/heapdump-bug-fix.patch new file mode 100644 index 0000000..02d4236 --- /dev/null +++ b/heapdump-bug-fix.patch @@ -0,0 +1,66 @@ +From 0251eb0780e088d3a8977d500c89dc33fff5bd06 Mon Sep 17 00:00:00 2001 +From: Whitney33 +Subject: [PATCH] heapdump bug fix + +--- + hotspot/src/share/vm/services/heapDumper.cpp | 21 +++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp +index 92bb81d01..5e05e4dab 100644 +--- a/hotspot/src/share/vm/services/heapDumper.cpp ++++ b/hotspot/src/share/vm/services/heapDumper.cpp +@@ -1938,8 +1938,20 @@ class VM_HeapDumper : public VM_GC_Operation { + assert(_global_writer == NULL, "Error"); + _global_writer = _local_writer; + } ++ void set_dump_instance_fields_descriptors() { ++ assert(_dump_instance_fields_descriptors == NULL, "Error"); ++ assert(_global_writer != NULL, "Error"); ++ if(_global_writer->getHeapDumpRedactLevel() == REDACT_ANNOTATION) { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_annotation_field_descriptors; ++ } else if(_global_writer->getHeapDumpRedactLevel() == REDACT_DIYRULES) { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_diyrules_field_descriptors; ++ } else { ++ _dump_instance_fields_descriptors = DumperSupport::dump_instance_field_descriptors; ++ } ++ } + void clear_global_dumper() { _global_dumper = NULL; } + void clear_global_writer() { _global_writer = NULL; } ++ void clear_dump_instance_fields_descriptors() { _dump_instance_fields_descriptors = NULL; } + + bool skip_operation() const; + +@@ -1979,13 +1991,6 @@ class VM_HeapDumper : public VM_GC_Operation { + _klass_map = new (ResourceObj::C_HEAP, mtInternal) GrowableArray(INITIAL_CLASS_COUNT, true); + _stack_traces = NULL; + _num_threads = 0; +- if(writer->getHeapDumpRedactLevel() == REDACT_ANNOTATION) { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_annotation_field_descriptors; +- } else if(writer->getHeapDumpRedactLevel() == REDACT_DIYRULES) { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_diyrules_field_descriptors; +- } else { +- _dump_instance_fields_descriptors = DumperSupport::dump_instance_field_descriptors; +- } + + if (oome) { + assert(!Thread::current()->is_VM_thread(), "Dump from OutOfMemoryError cannot be called by the VMThread"); +@@ -2290,6 +2295,7 @@ void VM_HeapDumper::doit() { + // the following should be safe. + set_global_dumper(); + set_global_writer(); ++ set_dump_instance_fields_descriptors(); + + // Write the file header - we always use 1.0.2 + size_t used = ch->used(); +@@ -2379,6 +2385,7 @@ void VM_HeapDumper::doit() { + // Now we clear the global variables, so that a future dumper might run. + clear_global_dumper(); + clear_global_writer(); ++ clear_dump_instance_fields_descriptors(); + } + + void VM_HeapDumper::dump_stack_traces() { +-- +2.43.0.windows.1 + diff --git a/openjdk-1.8.0.spec b/openjdk-1.8.0.spec index 2e5ebf7..ad0972d 100644 --- a/openjdk-1.8.0.spec +++ b/openjdk-1.8.0.spec @@ -953,7 +953,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r Name: java-%{javaver}-%{origin} Version: %{javaver}.%{updatever}.%{buildver} -Release: 1 +Release: 2 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -1368,6 +1368,10 @@ Patch455: 8159461-8288556-getComponentType.patch Patch456: 8136926-phi-NULL-assert-in-PhaseIdealLoop-try_move_s.patch Patch457: 8269934-RunThese24H.java-failed-with-EXCEPTION_ACCES.patch Patch458: 8352716-tz-Update-Timezone-Data-to-2025b.patch + +#452 +Patch459: heapdump-bug-fix.patch + ############################################# # # Upstreamable patches @@ -2045,6 +2049,7 @@ pushd %{top_level_dir_name} %patch456 -p1 %patch457 -p1 %patch458 -p1 +%patch459 -p1 %endif %ifarch loongarch64 @@ -2712,6 +2717,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %endif %changelog +* Sat May 17 2025 Benshuai5D -1:1.8.0.452.b09-2 +- add heapdump-bug-fix.patch + * Tue Apr 29 2025 wulongyao -1:1.8.0.452.b09-1 - add 8352716-tz-Update-Timezone-Data-to-2025b.patch -- Gitee