Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quarkus] Can't debug Quarkus application #15114

Open
svor opened this issue Nov 6, 2019 · 30 comments
Open

[Quarkus] Can't debug Quarkus application #15114

svor opened this issue Nov 6, 2019 · 30 comments
Labels
area/languages Issues related to Language extensions or plugins integration. kind/bug Outline of a bug - must adhere to the bug report template. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P2 Has a minor but important impact to the usage or development of the system.

Comments

@svor
Copy link
Contributor

svor commented Nov 6, 2019

While testing vscode-quarkus extension I detected a problem: if execute Quarkus: Debug Current Quarkus Project command, I see a message:
ERROR There is no debug configuration for undefined
in the browser console and the debugger doesn't execute, but the configuration was generated in launch.json file:

   {
      "preLaunchTask": "quarkus:dev",
      "type": "java",
      "request": "attach",
      "hostName": "localhost",
      "name": "Debug Quarkus application",
      "port": 5005
   }

If try to run this configuration from Debug view, I see a message that Task 'quarkus:dev' terminated with exit code 127.

screenshot-che-che 192 168 99 104 nip io-2019 11 06-11_04_46
Probably this problem can be related to add support integratedTerminal for debugging eclipse-theia/theia#6103

Che remote plugin with vscode-quarkus extension

apiVersion: v2
publisher: redhat
name: quarkus
version: 1.1.1
type: VS Code extension
displayName: Quarkus Tools
title: Quarkus Tools by Red Hat
description: This plug-in provides support for Quarkus development via a Quarkus language server and a Quarkus jdt.ls extension.
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
repository: https://github.com/redhat-developer/vscode-quarkus
category: Language
firstPublicationDate: "2019-11-05"
spec:
  containers:
    - image: "docker.io/eclipse/che-remote-plugin-runner-java11:next"
      name: vscode-quarkus
      memoryLimit: "1500Mi"
      volumes:
      - mountPath: "/home/theia/.m2"
        name: m2
  extensions:
    - https://github.com/microsoft/vscode-java-debug/releases/download/0.20.0/vscode-java-debug-0.20.0.vsix
    - https://download.jboss.org/jbosstools/static/jdt.ls/stable/java-0.50.0-1825.vsix
    - https://download.jboss.org/jbosstools/vscode/snapshots/vscode-quarkus/vscode-quarkus-1.1.1-158.vsix

@svor svor added kind/bug Outline of a bug - must adhere to the bug report template. area/languages Issues related to Language extensions or plugins integration. labels Nov 6, 2019
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Nov 6, 2019
@tsmaeder
Copy link
Contributor

tsmaeder commented Nov 6, 2019

@svor does it work if you ad the "console": "internal console" attribute to the launch config?

@tsmaeder tsmaeder mentioned this issue Nov 6, 2019
25 tasks
@svor
Copy link
Contributor Author

svor commented Nov 6, 2019

@tsmaeder It is not possible to add the console attribute to the launch configuration which has value of "request" attribute as "attach", we could do that if the configuration has "request": "launch" attribute. So, probably I was mistaken when wrote that this is related to eclipse-theia/theia#6103

@tsmaeder
Copy link
Contributor

tsmaeder commented Nov 6, 2019

Could very well be a duplicate of #15117

@tsmaeder
Copy link
Contributor

tsmaeder commented Nov 6, 2019

This might be a place to look. redhat-developer/vscode-quarkus@04e7652#diff-0dbbad2f7cd76714b5a5e9cba1b5495fR113 Suspicion: we are missing an environment variable.

@benoitf benoitf added this to the 7.5.0 milestone Nov 6, 2019
@benoitf benoitf added severity/P2 Has a minor but important impact to the usage or development of the system. and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Nov 6, 2019
@benoitf
Copy link
Contributor

benoitf commented Nov 6, 2019

setting milestone 7.5.0 as it's your sprint @tsmaeder

@tolusha
Copy link
Contributor

tolusha commented Nov 18, 2019

@amisevsk
Copy link
Contributor

Shouldn't "preLaunchTask": "quarkus:dev", be "preLaunchTask": "mvn quarkus:dev",?

@svor
Copy link
Contributor Author

svor commented Nov 19, 2019

@amisevsk quarkus:dev is task's name, the command is mvn quarkus:dev. Into debug configuration we have to put the name.

@amisevsk
Copy link
Contributor

@svor Ah apologies, I misunderstood.

@tsmaeder tsmaeder mentioned this issue Nov 21, 2019
26 tasks
@tsmaeder
Copy link
Contributor

tsmaeder commented Nov 27, 2019

The problem is that the pre-Launch task needs to be run in the dev container instead of the Theia sidecar

@tsmaeder
Copy link
Contributor

We propose to add configuration to the devfile that allows to execute tasks that are contributed by a VS Code extension in a different container, like:

task: "quarkus:dev"-> execute in: "quarkus-dev-machine".
Where "quarkus-dev-machine" is the alias of a component.

@tsmaeder
Copy link
Contributor

This needs to be addressed by the platform team.

@vparfonov vparfonov modified the milestones: 7.5.0, 7.6.0 Nov 28, 2019
@tsmaeder tsmaeder mentioned this issue Dec 13, 2019
28 tasks
@sunix sunix self-assigned this Dec 16, 2019
@skabashnyuk skabashnyuk removed this from the 7.6.0 milestone Dec 17, 2019
@sunix
Copy link
Contributor

sunix commented Dec 17, 2019

By default, I would run the task in the container where the extension is running.

@skabashnyuk
Copy link
Contributor

@sunix are you working on this task at this moment?

@tsmaeder
Copy link
Contributor

@skabashnyuk because we would need to be able to configure the container to execute in in the devfile.

@svor
Copy link
Contributor Author

svor commented Dec 17, 2019

@tsmaeder
I think the current task has two parts:
The first one (probably it is for platform team) is to make it possible to configure devfile to mark VS Code tasks (not commands) which should be executed in special container. As for me the structure should be like

tasks:
-
  label:
  component:

The second part is to adapt task runner process on che-theia side. In that part we should analyze workspace configuration and execute tasks in related container

@sunix
Copy link
Contributor

sunix commented Dec 17, 2019

To me, it sounds too complicated for the user to understand what this is about.
What I suggest:

  • By default either:
    1. component/container should be the one that is hosting the extension. (my prefered option)
    2. or we ask the user to choose the container where to run it.
  • if the devfile contains a command/task with the same name/label, it would use this one.

@skabashnyuk
Copy link
Contributor

I like the @sunix proposal. Removing the platform team label since it does not look like we need an extension to devfile format at this moment.

CC @l0rd

@tsmaeder
Copy link
Contributor

@sunix the component that registers the task is exactly not the one that should be executing it, in this concrete case.
I don't like that we need to push a decision to the user that we (or at least the author of a devfile) could make for her. Not sure the devfile is the correct location for this, but it would be great if we could preprocess contributions (turn them off, redirect execution to a particular container).

@sunix
Copy link
Contributor

sunix commented Dec 18, 2019

@sunix the component that registers the task is exactly not the one that should be executing it, in this concrete case.

By default yes it should: it is the only container where we are 100% sure that all the system dependencies are met. Quarkus extension would run on Java11 container and it is the only container where we are sure that it would have java and maven. Same if you take a openshift-connector and this extension would like to run oc commands, the container where the plugin is running is the only one where you are sure that you have oc installed.
It would work on any devfile. That's why it should be the default option.

I don't like that we need to push a decision to the user that we (or at least the author of a devfile) could make for her. Not sure the devfile is the correct location for this, but it would be great if we could preprocess contributions (turn them off, redirect execution to a particular container).

OK let's just don't give the user the ability to choose. Having that say, here is my new proposal:

  • component/container where to run the task should be the one that is hosting the extension.
  • if the devfile contains a command/task with the same name/label, it would use this one.

In concrete case, it's hard to tell if a devfile would have a dedicated runtime container to debug the app. If a devfile author is starting from nothing, he would just add his Quarkus project repository and the Che Quarkus plugin. Just with this devfile he should be able to start the Quarkus app in devmode and debug it. This is what would be possible if we execute the task in the container that is hosting the extension.
Then if he has a dedicated dev container, and want the Quarkus devmode task to be executed in this dedicated dev container, it is fine to tell him to adapt a devfile like https://github.com/redhat-developer-demos/quarkus-reactjs-postit-app/blob/a2d94f0b64f6fac6346af3a6ba6e7200feff2a6b/devfile.yaml#L111
And rename start DEVMODE quarkus-backend to quarkus:dev. Something we can document in the quarkus Che plugin documentation or welcome pane.

@tsmaeder
Copy link
Contributor

2 Steps:

  1. Establish connection between tasks & containers that contribute them. Run tasks in that container.
  2. Introduce label matching for commands/tasks
  3. Maybe introduce explicit syntax for redirecting tasks to containers.

@sunix
Copy link
Contributor

sunix commented Jan 6, 2020

currently on 1.

@tsmaeder tsmaeder mentioned this issue Jan 8, 2020
35 tasks
@tsmaeder tsmaeder mentioned this issue Jan 23, 2020
36 tasks
@tsmaeder tsmaeder added this to the Backlog - Languages milestone Jan 23, 2020
@che-bot che-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 27, 2020
@che-bot
Copy link
Contributor

che-bot commented Jul 27, 2020

Issues go stale after 180 days of inactivity. lifecycle/stale issues rot after an additional 7 days of inactivity and eventually close.

Mark the issue as fresh with /remove-lifecycle stale in a new comment.

If this issue is safe to close now please do so.

Moderators: Add lifecycle/frozen label to avoid stale mode.

@ericwill ericwill added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 27, 2020
@karstengresch
Copy link

Any news on this? The problem still persists, it seems.

@l0rd
Copy link
Contributor

l0rd commented Jul 5, 2021

@sunix this issue is assigned to you. Are you working on it?

@sunix sunix closed this as completed Jul 5, 2021
@sunix sunix reopened this Jul 5, 2021
@sunix
Copy link
Contributor

sunix commented Jul 5, 2021

@l0rd no I am not working on it. I had started to have a look when language team was merged with the plugins team and I moved to a community role.

So this is not working because it is using the task provided by the vscode extension. At the moment, to debug quarkus app, we would suggest users to use a task defined in the devfile like this: https://github.com/eclipse-che/che-devfile-registry/blob/main/devfiles/quarkus/devfile.yaml#L101-L117

  -
    name: Attach remote debugger
    actions:
    - type: vscode-launch
      referenceContent: |
        {
          "version": "0.2.0",
          "configurations": [
            {
              "type": "java",
              "request": "attach",
              "name": "Attach to Remote Quarkus App",
              "hostName": "localhost",
              "port": 5005
            }
          ]
        }

@ericwill How would we prioritize this ?

@sunix sunix removed their assignment Jul 5, 2021
@ericwill
Copy link
Contributor

ericwill commented Jul 5, 2021

There is a workaround present for this right? I'd say it should be taken as part of sprint 205 (in ~3 weeks from now).

@karstengresch
Copy link

At the moment, to debug quarkus app, we would suggest users to use a task defined in the devfile like this: https://github.com/eclipse-che/che-devfile-registry/blob/main/devfiles/quarkus/devfile.yaml#L101-L117

  -
    name: Attach remote debugger
    actions:
    - type: vscode-launch
      referenceContent: |
        {
          "version": "0.2.0",
          "configurations": [
            {
              "type": "java",
              "request": "attach",
              "name": "Attach to Remote Quarkus App",
              "hostName": "localhost",
              "port": 5005
            }
          ]
        }

Thanks for that, @sunix. Actually this is the config that comes with the default Quarkus template on CRW. I actually asked for the current status because I cannot confirm this workaround is working:

Created a breakpoint, started Quarkus in dev + debug mode, called a service (getting-started quarkus example with one additional sysout line) - IDE doesn't interrupt... :-|

@svor
Copy link
Contributor Author

svor commented Jul 8, 2021

Thanks for that, @sunix. Actually this is the config that comes with the default Quarkus template on CRW. I actually asked for the current status because I cannot confirm this workaround is working:
Created a breakpoint, started Quarkus in dev + debug mode, called a service (getting-started quarkus example with one additional sysout line) - IDE doesn't interrupt... :-|

@karstengresch which CRW version do you have? Could you please share a link to the devfile

@sunix
Copy link
Contributor

sunix commented Jul 19, 2021

@karstengresch if you don't have the exact same issue described in this issue, it may be another problem and it may have already been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/languages Issues related to Language extensions or plugins integration. kind/bug Outline of a bug - must adhere to the bug report template. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. severity/P2 Has a minor but important impact to the usage or development of the system.
Projects
None yet
Development

No branches or pull requests