On Fri, 24 Jun 2022 03:32:13 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> Zhengyu Gu has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains 18 additional >> commits since the last revision: >> >> - Improve naming and cleanup >> - Merge branch 'master' into JDK-8256811-jdi-missing-class-unloading-event >> - v4 >> - v3 >> - v2 >> - Merge branch 'master' into JDK-8256811-jdi-missing-class-unloading-event >> - Merge branch 'jdi_tmp' into JDK-8256811-jdi-missing-class-unloading-event >> - v0 >> - v2 >> - v1 >> - ... and 8 more: https://git.openjdk.org/jdk/compare/d5eafb33...559b4bf1 > > src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c line 627: > >> 625: >> 626: if (evinfo->ei == EI_CLASS_UNLOAD) { >> 627: synthesizeUnloadEvent((char*)jlong_to_ptr(evinfo->tag), env); > > You're in uncharted waters here. Previously `event_callback()` was always > called with a `thread` argument except for VMDeath. Now it is being called > during an ObjectFree, which has no thread associated with it. That means all > the code below that is executed when we have a thread is no longer being > executed after the ClassUnload events are generated by the > `synthesizeUnloadEvent()` call. Have you thought this part through? > > My guess is that for the most part it is harmless. The "invoke" support is > not relevant in this case. I think/hope that means there is no need for > calling `threadControl_onEventHandlerEntry()`. The `filterAndHandleEvent()` > probably amounts to an (expensive) nop, although it seems silly to be calling > it for the `ObjectFree` event. I'd suggest just returning at this point in > the code, but you do still have the restoration of the pending exception to > handle. Maybe that should just be done here and then return. It will make it > a lot more clear that the rest of the code below is not needed. I did not thought through this part. I hooked up `ObjectFree` event in `event_callback()` to behave like other events, now I see it is probably not a good idea. Reverted. ------------- PR: https://git.openjdk.org/jdk/pull/9168