JDK-8338708 : Don't create/destroy debug agent cmdQueueLock for each connection
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: debugger
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-08-21
  • Updated: 2024-09-05
  • Resolved: 2024-09-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b14Fixed
Related Reports
Relates :  
Description
Currently each time there is a new debug agent connection established, the cmdQueueLock is allocated. It is then destroy when the connection is dropped, only to be recreated on the next connection. I looked closely at the use of this lock, and what happens when the connection is dropped, and I can't see any reason to create and then dispose of cmdQueueLock for each connection. Of the 18 debug agent raw monitors, this is the only one that gets destroyed and recreated. The other 17 stick around for the next connection. I'd like to get rid of this reallocation in order to support static initialization of all the debug agent raw monitors on startup. This will be done as part of the ranked monitor support (JDK-8328866).

As part of the testing for this change, I put an assert in place when we try to create cmdQueueLock for the 2nd time. I ran all our debugger tests, and unfortunately none of them failed. This means we don't currently test attaching to the debug agent more than once in any of our tests, so I did two things to better test out this change. The first was to write a test that attaches numerous times in sequence, and the 2nd was to manually attach and reattach using jdb. At the same time I stepped through the debug agent code in gdb just to better help understand the setup and use of cmdQueueLock. I didn't see anything that gave me concern about making this change.
Comments
Changeset: 5ebdf2d2 Branch: master Author: Chris Plummer <cjplummer@openjdk.org> Date: 2024-09-03 19:06:00 +0000 URL: https://git.openjdk.org/jdk/commit/5ebdf2d2720b82c4e9783fc6a9aa58344d5e2f2a
03-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20755 Date: 2024-08-28 21:40:57 +0000
28-08-2024