Skip to content

Add debug restart#508

Merged
awisniew90 merged 8 commits intoOpenLiberty:mainfrom
awisniew90:debug-restart
Jan 27, 2025
Merged

Add debug restart#508
awisniew90 merged 8 commits intoOpenLiberty:mainfrom
awisniew90:debug-restart

Conversation

@awisniew90
Copy link
Contributor

@awisniew90 awisniew90 commented May 8, 2024

Fixes #498

This PR creates the following behaviors:

  1. A Hot Code Replace failure will now prompt the user to "refresh" the debugger. This will result in the debugger being disconnected and reconnected
    2. A restart of the server from dev mode via the command line will result in the debugger being disconnected and reconnected when the server restarts (using whatever debug port dev mode chose)
    3. When in debug mode, the debugger is always on.... if disconnected (automatically or manually), it will always attempt to reconnect.

After reviewing, it seemed overkill to attempt to reconnect the debugger on every disconnect. This also created issues when intentionally disconnecting the debugger. In place of number 2 and 3 above, we are instead adding a "Connect Liberty Debugger" action to the Debug view context menu. If the debugger is disconnected (due to a restart of the server or manual disconnect), a user can now reconnect without having to stop and start the application via the Dashboard.

----- More Details ------

In the second rendition of the Liberty Tools debugger (prior to this PR), the debugger was combined with the Maven/devmode process into one launch configuration. This meant that the lifecycle of the two processes were tightly coupled causing undesired behavior. For example, a disconnect of the debugger triggered a full termination of the application running in Maven. 3 ways this disconnect could happen is either via a HCR failure, a restart of the server via devmode, or a manual disconnect via the debug view context menu.

This PR makes the following improvements:

  1. A custom HCR failure dialog is presented to the user with an option to restart the debugger. This does so without a restart to the Maven/devmode process.
  2. A new LibertyDebugTarget is used which overrides the default JDIDebugTarget disconnect behavior by not triggering a "terminate" of the launch (the root problem).
  3. Introduces a "Connect Liberty Debugger" action to the debug view context menu.

@scottkurz
Copy link
Collaborator

This is a nice improvement on the HCR failure path.

Now that I appreciate the use case better... I can also appreciate that it still leaves say the path in which dev mode restarts the server upon a bootstrap.properties update.

Let's think about that more.

@awisniew90 awisniew90 force-pushed the debug-restart branch 5 times, most recently from cd61919 to 5ce2066 Compare July 12, 2024 14:46
@awisniew90 awisniew90 force-pushed the debug-restart branch 2 times, most recently from 5c608df to c95e3ee Compare August 20, 2024 17:27
Adam Wisniewski and others added 2 commits January 2, 2025 10:57
Signed-off-by: Adam Wisniewski <awisniew@Adams-MacBook-Pro.local>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
@scottkurz
Copy link
Collaborator

Just capturing that we reviewed this today and thought it'd be good to get rid of the automatic reconnect on disconnect. We can still have the overloaded reconnect selection button on HCR failure. We also are good with the idea that each Run/Debug config can define its own reconnect/disconnect behavior, so us defining our own is fine from that POV.

Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
@awisniew90 awisniew90 marked this pull request as ready for review January 9, 2025 17:50
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Copy link
Collaborator

@scottkurz scottkurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See what you think.

Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Signed-off-by: Adam Wisniewski <awisniew@us.ibm.com>
Copy link
Collaborator

@scottkurz scottkurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - will run one more set of tests when we think we're done.

@awisniew90 awisniew90 merged commit d05f7b8 into OpenLiberty:main Jan 27, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restart (r) in dev mode kills the debugging session

2 participants