On Wed, 25 Nov 2026 16:01:08 GMT, Shiv Shah <[email protected]> wrote:
> No test calls ThreadStartRequest.addPlatformThreadsOnlyFilter() directly. > This adds one. > > The debuggee starts two platform and two virtual threads itself, joins them > and hits a breakpoint. The debugger has a filtered start request and a plain > one enabled side by side. The filtered one must see each platform thread once > and neither virtual thread. The plain one must see all four, otherwise the > zero on the filtered side proves nothing. After that the plain requests are > deleted and a second set of threads runs with only the filtered requests on. > > Same checks for ThreadDeathRequest in the same test, it has the same method. > > Carrier threads start in the middle of this and land on the filtered requests > too. Those are not counted, the test only checks that none of them is virtual. > > It creates its own threads, it does the same with and without the virtual > thread factory. No existing test is touched. Not covered: the filter combined > with a thread filter or count filter, and calling it on an enabled or deleted > request. > > Checked that it can fail. With the two filter calls removed it does. > > --- > > Testing: > - [x] the new test on linux x64, linux aarch64, windows x64 and macos > aarch64, debug and product, with and without the virtual thread factory, plus > -Xcomp and ZGC on the debug builds. jdk_jdi with the virtual thread factory > on linux x64 and aarch64. tier1-3 on linux x64 and aarch64, the only failures > there also fail in mainline CI. > > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). test/jdk/com/sun/jdi/PlatformThreadsOnlyFilterTest.java line 183: > 181: boolean filtered = filteredStart.equals(event.request()) || > filteredDeath.equals(event.request()); > 182: boolean counted = workers.stream().anyMatch(worker -> > worker.thread().equals(event.thread())); > 183: if (filtered && !counted && isVirtual(event.thread())) { Theoretically this event could have been on a virtual thread outside the control of the test, and that thread is now collected. You swallow the ObjectCollectedException in isVirtual(), leading to isVirtual() returning false, even if the thread was virtual. Perhaps you should should just call ObjectReference.isVirtual() directly, and be explicit about the skipping of collected threads rather than rely on the implicit skipping when the test version of isVirtual() returns false. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/34069#discussion_r4790486819
