Disable Live Coding to use Eclipse Debugger or "Apply Code Changes" in IDE

334 views
Skip to first unread message

Antoine D

unread,
Feb 19, 2021, 9:33:00 AM2/19/21
to Quarkus Development mailing list

Hi,
I'd like to use Quarkus for the backend of a web application, instead of using SpringBoot for instance.
The problem is that Eclipse "java builder" that helps a lot to automatically build and apply code changes has conflict with the live coding.
I'd like juste to add few lines of code in a function, or a trace, without changing the schema of the class I want to debug.
For a classic Java Application, Eclipse debugger is powerfull for that, it goes back to the stack when the code is changed when you add lines when you debug.

So, I'd like to use @QuarkusMain to get a simple java app, and disable Live Coding.
Any idea?
Thanks a lot!

Martin Kouba

unread,
Feb 25, 2021, 3:11:52 AM2/25/21
to irii...@gmail.com, Quarkus Development mailing list
Quarkus hot deployment (aka live coding) is only enabled in the
development mode. How exactly do you run your application?


> Any idea?
> Thanks a lot!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Quarkus Development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to quarkus-dev...@googlegroups.com
> <mailto:quarkus-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/quarkus-dev/4d478f58-3f91-429f-85a0-199fb363d64fn%40googlegroups.com
> <https://groups.google.com/d/msgid/quarkus-dev/4d478f58-3f91-429f-85a0-199fb363d64fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Martin Kouba
Software Engineer
Red Hat, Czech Republic

Max Rydahl Andersen

unread,
Feb 25, 2021, 11:17:03 AM2/25/21
to Martin Kouba, irii...@gmail.com, Quarkus Development mailing list
On 25 Feb 2021, at 9:11, Martin Kouba wrote:

> On 19. 02. 21 15:33, Antoine D wrote:
>>
>> Hi,
>> I'd like to use Quarkus for the backend of a web application, instead
>> of using SpringBoot for instance.
>> The problem is that Eclipse "java builder" that helps a lot to
>> automatically build and apply code changes has conflict with the live
>> coding.
>> I'd like juste to add few lines of code in a function, or a trace,
>> without changing the schema of the class I want to debug.
>> For a classic Java Application, Eclipse debugger is powerfull for
>> that, it goes back to the stack when the code is changed when you add
>> lines when you debug.
>>
>> So, I'd like to use @QuarkusMain to get a simple java app, and
>> disable Live Coding.
>
> Quarkus hot deployment (aka live coding) is only enabled in the
> development mode. How exactly do you run your application?

I recognise his issue - it happens when you run in dev mode - connect
debugger and then do changes. eclipse (and other IDE's) will hot replace
method bodies
just fine - but in quarkus devmode when you hit the browser quarkus will
trigger a full restart of the app. Which works fast, but you now lost
your state.

Thus Anotine is asking for a way to pause the auto-build/restart part of
Quarks dev mode.

/max

>
>
>> Any idea?
>> Thanks a lot!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Quarkus Development mailing list" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to quarkus-dev...@googlegroups.com
>> <mailto:quarkus-dev...@googlegroups.com> .
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/quarkus-dev/4d478f58-3f91-429f-85a0-199fb363d64fn%40googlegroups.com
>> <https://groups.google.com/d/msgid/quarkus-dev/4d478f58-3f91-429f-85a0-199fb363d64fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>
> --
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
>
> --
> You received this message because you are subscribed to the Google
> Groups "Quarkus Development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to quarkus-dev...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/quarkus-dev/c4df42e2-cccd-252d-61df-a99f05422352%40redhat.com.

/max
https://xam.dk/about

Antoine D

unread,
Feb 25, 2021, 1:19:55 PM2/25/21
to Quarkus Development mailing list
Thanks max!
It's what I meant: you lost the context, some objects in memory...

Of course when the class schema is changed, the IDE is not able to update the class, but for a tiny modification (add a system.out for instance), thie Live Coding makes debug slower.
Plus, you don't want sometime to go to the page and do a reload, when actually you're not debug a REST class but a library.

I use the CLI mode, with a @QuarkusMain + waitForExit(), and I tried launching my app in debug mode in Eclipse with the Main class.
I tried -Ddebug=false too. No sucess.
I think that Quarkus detects the IDE and launch the app in a special mode.

Martin Kouba

unread,
Feb 26, 2021, 4:11:44 AM2/26/21
to Max Rydahl Andersen, irii...@gmail.com, Quarkus Development mailing list
On 25. 02. 21 17:16, Max Rydahl Andersen wrote:
> On 25 Feb 2021, at 9:11, Martin Kouba wrote:
>
>> On 19. 02. 21 15:33, Antoine D wrote:
>>>
>>> Hi,
>>> I'd like to use Quarkus for the backend of a web application, instead
>>> of using SpringBoot for instance.
>>> The problem is that Eclipse "java builder" that helps a lot to
>>> automatically build and apply code changes has conflict with the live
>>> coding.
>>> I'd like juste to add few lines of code in a function, or a trace,
>>> without changing the schema of the class I want to debug.
>>> For a classic Java Application, Eclipse debugger is powerfull for
>>> that, it goes back to the stack when the code is changed when you add
>>> lines when you debug.
>>>
>>> So, I'd like to use @QuarkusMain to get a simple java app, and
>>> disable Live Coding.
>>
>> Quarkus hot deployment (aka live coding) is only enabled in the
>> development mode. How exactly do you run your application?
>
> I recognise his issue - it happens when you run in dev mode - connect
> debugger and then do changes. eclipse (and other IDE's) will hot replace
> method bodies
> just fine - but in quarkus devmode when you hit the browser quarkus will
> trigger a full restart of the app. Which works fast, but you now lost
> your state.

Not really, I believe that Quarkus is using JVM instrumentation by
default since 1.11, i.e. the app is only restarted if needed.

There is a config option to disable this behavior:
https://quarkus.io/guides/all-config#quarkus-core_quarkus.dev.instrumentation

Max Andersen

unread,
Feb 26, 2021, 4:16:16 AM2/26/21
to Martin Kouba, irii...@gmail.com, Quarkus Development mailing list
How does that work? :)

Jvms can't generally replace class structure changes not can our frameworks pick them up without reloading/restarting thus loosing state ...or is there some new magic trick I'm not aware of ? 

/max
On 26 Feb 2021, 10:11 +0100, Martin Kouba <mko...@redhat.com>, wrote:
Not really, I believe that Quarkus is using JVM instrumentation by
default since 1.11, i.e. the app is only restarted if needed.

There is a config option to disable this behavior:

Georgios Andrianakis

unread,
Feb 26, 2021, 4:18:40 AM2/26/21
to Max Rydahl Andersen, Martin Kouba, irii...@gmail.com, Quarkus Development mailing list
On Fri, Feb 26, 2021 at 11:16 AM Max Andersen <mand...@redhat.com> wrote:
How does that work? :)

Jvms can't generally replace class structure changes not can our frameworks pick them up without reloading/restarting thus loosing state ...or is there some new magic trick I'm not aware of ? 


/max
On 26 Feb 2021, 10:11 +0100, Martin Kouba <mko...@redhat.com>, wrote:

Not really, I believe that Quarkus is using JVM instrumentation by
default since 1.11, i.e. the app is only restarted if needed.

There is a config option to disable this behavior:
quarkus.io/guides/all-config#quarkus-core_quarkus.dev.instrumentation

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.

Max Andersen

unread,
Feb 26, 2021, 4:23:54 AM2/26/21
to Georgios Andrianakis, Martin Kouba, irii...@gmail.com, Quarkus Development mailing list
Ah nice. So we do a best effort on doing minimal impact change. 

We probably should explain that in the docs of that property ...and release notes as that's noteworthy (if you tell me a missed that too I'm officially blind :)

So iriikoad, upgrade to 1.11+ to get quarkus that will do only instrumentation update if possible and if you really want to not see any restarts set the instrumentation property to false. 




/max

Georgios Andrianakis

unread,
Feb 26, 2021, 4:27:46 AM2/26/21
to Max Andersen, Martin Kouba, irii...@gmail.com, Quarkus Development mailing list
On Fri, Feb 26, 2021 at 11:23 AM Max Andersen <mand...@redhat.com> wrote:
Ah nice. So we do a best effort on doing minimal impact change. 

We probably should explain that in the docs of that property ...and release notes as that's noteworthy (if you tell me a missed that too I'm officially blind :)

It seems like we didn't mention it as noteworthy in the release (although I agree we probably should have labeled it as such). As for the docs, I don't really know where the proper place to put this info would be

Antoine D

unread,
Mar 11, 2021, 5:44:24 AM3/11/21
to Quarkus Development mailing list
Thanks for all your replies, and sorry to reply just now.

I'm on Quarkus 1.11.3.Final.
I tried the property
quarkus.dev.instrumentation=false

No success. It's still reload the class and on conflict with Eclipse, when I use the Quarkus plugin, or even if I launch my app using a main + @QuarkusMain + Quarkus.run(Main.class, args);.

@QuarkusMain
public class Main implements QuarkusApplication {

    public static void main(String[] args) {
        Quarkus.run(Main.class, args);
    }

    @SuppressWarnings("unused")
    @Override
    public int run(String... args) throws Exception {
        Quarkus.waitForExit();
        return 0;
    }
}
For info, it's this kind of error if I active Eclipse auto build and just modify the System.out .

Loosing the context, not able to add a simple test to active a breakpoint during debug like adding these line during debug for instance (see below) is annoying. :(
  "if ( cmd.contains("the string that may cause a issue")){
    int stop = 0;
     stop ++; --> breakpoint here

Max Rydahl Andersen

unread,
Apr 1, 2021, 6:14:11 AM4/1/21
to Antoine D, Quarkus Development mailing list

> Thanks for all your replies, and sorry to reply just now.

same here - just catching up :)

the error you show below I kinda remember as eclipse being overly eager
to show.

Are you saying even you click continue on that dialog you are no longer
able to put breakpoints ?

any chance you can make a reproducer showing what kind of edit you make
and where you can't
do what you think I can ?

asking as my basic attempt on this did not see it happen.
/max

>
> I'm on Quarkus 1.11.3.Final.
> I tried the property
> *quarkus.dev.instrumentation=false*
>
> No success. It's still reload the class and on conflict with Eclipse,
> when
> I use the Quarkus plugin, or even if I launch my app using a* main +
> @QuarkusMain + Quarkus.run(Main.class, args);.*
>
> @QuarkusMain
> public class Main implements QuarkusApplication {
>
> public static void main(String[] args) {
> Quarkus.run(Main.class, args);
> }
>
> @SuppressWarnings("unused")
> @Override
> public int run(String... args) throws Exception {
> Quarkus.waitForExit();
> return 0;
> }
> }
> For info, it's this kind of error if I active Eclipse auto build and
> just
> modify the System.out .
>
>>>> <https://groups.google.com/d/msgid/quarkus-dev/a9796fa2-956b-4a6f-afb9-4516a288bad0%40Spark?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Quarkus Development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to quarkus-dev...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/quarkus-dev/beff9a54-721e-4d9a-b05b-a3f69978ba31n%40googlegroups.com.


/max
https://xam.dk/about

Antoine D

unread,
Apr 1, 2021, 8:33:19 AM4/1/21
to Quarkus Development mailing list
Thanks for the reply.

I think you don't have it because the "Automatic build" is not set in your workspace.
Do you?

Antoine D

unread,
Apr 1, 2021, 11:03:56 AM4/1/21
to Quarkus Development mailing list
I have also a problem with dependencies libraries that contains a classic singleton like this:

public class SingletonObject {

    private static SingletonObject instance;
    
    private SingletonObject() {}
    
    public static synchronized SingletonObject getInstance() {
        if(instance == null) {
            instance = new SingletonObject();
            System.out.println("SingletonObject created : " + instance);
        }
        return instance;
    }
    
    public void doSomething() {
        System.out.println("SingletonObject doSomething . Instance=" + instance);
    }
    
}


If this class "SingletonObject" is inside the projet Quarkus, static attribute "instance" is reset to NULL when Quarkus restarts the app. So it's good.

But if you put it this class in a dependency, "instance" stays set, and this result to unexpected behaviour on other dependencies that use it.

I reproduced the issue on the "getting started" app:
- I created a library  org.acme.test.libx and put the class SingletonObject
- I created and put SingletonObjecInternal next to GreetingResource.java

@Path("/hello")
public class GreetingResource {

    @Inject
    Logger logger;
    
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        SingletonObject.getInstance().doSomething();                  //-> in a dependency lib
         SingletonObjecInternal.getInstance().doSomething();    //-> next to GreetingResource, in same package
        return "Hello RESTEasy";
    }

}


On first call to "/hello", I see the correct output:

SingletonObject created: org.acme.test.libx.SingletonObject@3f0cf00
SingletonObject doSomething. Instance=org.acme.test.libx.SingletonObject@3f0cf00

SingletonObjecInternal created: org.acme.getting.started. SingletonObjecInternal@2dd5b5f7
SingletonObjecInternal doSomething. Instance=org.acme.getting.started SingletonObjecInternal@2dd5b5f7


I modified the class to make sure Quarkus restarts the application, then re-call "/hello", and I see:

SingletonObject doSomething. Instance=org.acme.test.libx.SingletonObject@3f0cf00
SingletonObjecInternal created: org.acme.getting.started. SingletonObjecInternal@a32c824
SingletonObjecInternal doSomething. Instance=org.acme.getting.started SingletonObjecInternal@a32c824
==> The static instance of SingletonObject  (external dependency) is not reset, we don't see "SingletonObject  created".

Maybe it needs an other question thread?
Ps: I tried in 1.13.0.Final.

Thanks a lot for your help.

Antoine D

unread,
Apr 26, 2021, 4:29:07 AM4/26/21
to Quarkus Development mailing list
Hello all,

I'm trying to wake up this discussion, the main purpose (I did a issue on GitHub for the my last message and it seems to be resolved already, good job!):

I want to use the IDE debugger and not the hot reload functionality, specially now that instrumentation is disable by default, because the app I'd like to do is more complex than a simple reply to a REST request, so I use @QuarkusMain like a springBoot app.

Event launching in debug the main with Eclipse, without mvn quarkus:dev, the bytecode generated not seems to be compatible, plus a modification on a file is still detected by Quarkus and it re-starts the app: my expectation is to use Eclipse debugger functionality : it is able to go back in the stack in few seconds when I do a tiny modification on a breakpoint, wihtout loosing all the context of the app.
So is there a way to full disable Quarkus hot reload and optimisation during debug session when launched with a @QuarkusMain ?
Thanks a lot!
Reply all
Reply to author
Forward
0 new messages