Bug 547229 - Debug Shell with Remote Java Application connection reports "Evaluation failed" for valid expressions
Summary: Debug Shell with Remote Java Application connection reports "Evaluation faile...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.11   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2019-05-13 12:37 EDT by David M. Karr CLA
Modified: 2023-05-24 07:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David M. Karr CLA 2019-05-13 12:37:36 EDT
Using 2019-03.

I have a SpringBoot/Maven application.  If I run it in debug as Spring Boot App, the Variables pane is properly populated, hovers show variables, and I can evaluate variables and expressions in the Debug Shell, for expressions referencing variables that are all in scope.

Instead of running this as a standalone SpringBoot app, I'm running it in a Docker container, with the Java command line specifying the "Xdebug" parameters.  I'm running this in a Linux VM, which is running on a Windows7 laptop.

If I run Eclipse in the Linux VM and connect to the SpringBoot app as a "Remote Java Application", almost everything works just the same as a normal standalone SpringBoot app.  The Variables pane is properly populated, and hovers show the same variable values.

However, something is wrong with the Debug Shell.  No matter what expression I enter and evaluate, it always returns:

    Evaluation failed. Reason(s):
		Evaluations must contain either an expression or a block of well-formed statements

It even does this for constant expressions, like "1".

I'm also running the same version of Eclipse on The Win7 laptop, and I can make a similar connection as a "Remote Java Application" to the process running on the VM (mapping port 5005 in VirtualBox to the host).  I get the exact same behavior in this Eclipse.  The Variables panel is correct, hovers are correct, and the Debug Shell gives the same errors.

Creating a repeatable test case for this will be very difficult.  I tried a very trivial test case, with a standalone "hello world" app running in the VM.  The Debug Shell has no trouble with a Remote Java Application connection to that app.  The next step would be setting up a Docker image and container.  That will take more time, and I have to spend time on other work this morning.
Comment 1 David M. Karr CLA 2019-05-14 09:27:56 EDT
Could this possibly be caused by running a particular JRE (not JDK) in the container?  The image is based on the Alpine JRE image.  I was planning on doing some testing today to change the base image to be a JDK-based image.  Is there any chance that will make a difference?
Comment 2 Sarika Sinha CLA 2019-05-15 02:15:30 EDT
Have you tried changing suspend=n to suspend=y to let it wait until you attach the debugger.
Comment 3 David M. Karr CLA 2019-05-15 09:41:07 EDT
No, but I can't imagine how that could be relevant to this.  Do you have a specific reason you're asking about that?
Comment 4 David M. Karr CLA 2019-05-16 18:21:48 EDT
After having to fix several other problems, and having some make a JDK-based image available to me, I've determined that this doesn't make any difference.  With the JDK-based image, I can see the variables, but nothing useful happens in the Debug Shell view.
Comment 5 David M. Karr CLA 2019-05-16 18:36:07 EDT
And now concerning the suggestion to change "suspend" to "y".

This had no impact in the application code that I was trying to debug.  However, this provided what I hope will be an important clue to someone out there.

I also had a breakpoint set in "org.springframework.core.io.ClassPathResource.getInputStream()" to debug an unrelated problem.  Normally, when "suspend" is "n", I don't attempt to connect from the debugger until I finally see the "Started Application in ..." message from the SpringBoot framework. If I do that, then I don't hit the breakpoint in ClassPathResource, because it's done with all that work by that time.

When I changed "suspend" to "y" and then connected my debugger at closer to startup, it DID hit that breakpoint, and what I discovered was that at that point, the Debug Shell view was working perfectly fine, at that breakpoint.

However, when I resumed and let it finish starting up, and then performed the test that hit the breakpoint in my application code, the Debug Shell was then back to being useless, despite the fact that I could see all the variable info in the Variables panel and in hovers.

Why would the Debug Shell be working properly at that point in the Spring code, but not in my application code?
Comment 6 David M. Karr CLA 2019-05-16 18:45:31 EDT
One difference between these two cases is that when it hits the breakpoint in ClassPathResource, it's in the thread "main", but when it hits the breakpoint in my application code, it's in a "Daemon Thread".  In any case, the behavior is consistent. When it hits the Spring code in the main thread, the Debug Shell works fine.  When it hits the application code in the Daemon Thread, the Debug Shell doesn't work.
Comment 7 Sarika Sinha CLA 2019-05-17 00:09:24 EDT
Thank you for all the investigations, will see if someone can work on this.
Comment 8 Eclipse Genie CLA 2021-05-07 08:12:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Eclipse Genie CLA 2023-05-24 07:57:55 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.