Skip to content


8294924: JvmtiExport::post_exception_throw() doesn't deal well with c…
Browse files Browse the repository at this point in the history
…oncurrent stack processing

Reviewed-by: pchilanomate, sspitsyn, dholmes
  • Loading branch information
fisk committed Nov 30, 2022
1 parent be99e84 commit be4245e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/hotspot/share/prims/jvmtiExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include "runtime/javaCalls.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/jniHandles.inline.hpp"
#include "runtime/keepStackGCProcessed.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/objectMonitor.inline.hpp"
#include "runtime/os.hpp"
Expand Down Expand Up @@ -1964,6 +1965,11 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre
HandleMark hm(thread);
methodHandle mh(thread, method);
Handle exception_handle(thread, exception);
// The KeepStackGCProcessedMark below keeps the target thread and its stack fully
// GC processed across this scope. This is needed because there is a stack walk
// below with safepoint polls inside of it. After such safepoints, we have to
// ensure the stack is sufficiently processed.
KeepStackGCProcessedMark ksgcpm(thread);

JvmtiThreadState *state = thread->jvmti_thread_state();
if (state == NULL) {
Expand Down

1 comment on commit be4245e

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.