8.0.1 Debug: Class Reloading does not work?

Hello,

Does class reloading work for you? It does not seem to be working in 8.0.1
for me

Thank you,

Alex


14 comments
Comment actions Permalink

I just noticed this too, it appears to work on the first recompile of the project, but if you change the code again and recompile it doesn't work.  This is a major problem....


EDIT:  We're using JDK 1.5 and Tomcat 5.5.25 - 5.5.27

0
Comment actions Permalink

Hello Eugene,

This is not what Chris or I mean. JVM accepts new bytecode fine (in my case
only method body changes no method/class signature changes) but the changes
are not taking effect. It works very ocasionally mostly not.
I am running it on winxp under jdk 1.6u10 32-bit. Tomcat is running under
the same JVM. I tried tomcat under JVM 1.5 same result which tells me it
might not be debugged JVM which is at fault

Alex

"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message
news:gh6ard$8a8$1@is.intellij.net...

Chris, please see my comments on the issue

>

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

>
>

"Chris" <no_reply@jetbrains.com> wrote in message
news:29038391.11091228251910188.JavaMail.clearspace@app4.labs.intellij.net...

>>I just noticed this too, it appears to work on the first recompile of the
>>project, but if you change the code again and recompile it doesn't work.
>>This is a major problem....
>>
>> ---
>> Original message URL:
>> http://www.jetbrains.net/devnet/message/5228085#5228085
>



0
Comment actions Permalink

Hi Alex,

only method body changes no method/class signature changes) but the changes are not taking effect. It works very ocasionally
mostly not.


Please tell me how could IDEA influence execution inside JVM? I can repeat again that actual class reloading is done by the JVM and
this is the JVM that uses reloaded classes. Debug API provides a possiblity to reload classes (this is in fact one API call
"redefineClasses()") which is used by IDEA to supply the JVM with the new byte code. The method can either execute normally or throw
an exception indicating that the operation failed. If method completed normally, the classes are supposed to be redefined.
Sun's documentation notes that "If a redefined method has active stack frames, those active frames continue to run the bytecodes of
the previous version of the method" and maybe this is what happens in your case. Anyway, you cannot blame IDEA for JVM not using
updated bytecode since JVM claims the bytecode was successfully updated. This is simply not uder IDEA's control. The only problem
with IDEA could be that the bytecode was changed but not offered to JVM for reload, but this functionality works ok if I understood
that right from the post.


--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Eugene,

I only can state that I do not get JVM message refusing to accept code
changes. Whether they are sent fully or partially or not at all I do not
know. All I know that when I change a method body and recompile the class
new code is not taking effect untill I exit the app and restart it. It might
very well be a JVM problem but then we would need a confirmation from you
and some recommendations on how to work around it if it is possible.

I have been using IDEA remote debugging for quite a few years and believe
there is a significant difference in behavior of the latest versions which
makes class reloading not work for me in a setup which I have been using for
long time.

If you have any suggestions as what I should try to do to help with
investigation, please let me know

Thank you,
Alex




"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message
news:gh6k69$m11$1@is.intellij.net...

Hi Alex,

>
>> only method body changes no method/class signature changes) but the
>> changes are not taking effect. It works very ocasionally mostly not.
>

Please tell me how could IDEA influence execution inside JVM? I can repeat
again that actual class reloading is done by the JVM and this is the JVM
that uses reloaded classes. Debug API provides a possiblity to reload
classes (this is in fact one API call "redefineClasses()") which is used
by IDEA to supply the JVM with the new byte code. The method can either
execute normally or throw an exception indicating that the operation
failed. If method completed normally, the classes are supposed to be
redefined.
Sun's documentation notes that "If a redefined method has active stack
frames, those active frames continue to run the bytecodes of the previous
version of the method" and maybe this is what happens in your case.
Anyway, you cannot blame IDEA for JVM not using updated bytecode since JVM
claims the bytecode was successfully updated. This is simply not uder
IDEA's control. The only problem with IDEA could be that the bytecode was
changed but not offered to JVM for reload, but this functionality works ok
if I understood that right from the post.

>
>

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

>



0
Comment actions Permalink

Alex,

In Settings | Debugger | HotSwap set "Reload classes after compilation" option to "Ask". Change some class and compile.
If reload was successful, IDEA writes in the status bar "N classes reloaded".
Can you see this message in the status bar after you confirmed reload?

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Eugene,

Yes I do see the message (12 classes reloaded some nested classes there)
There are two cases which 100% do not get reloaded (not sure what JVM DI
specs say about it) static fields and instance field initial value change
does not get reflected in reloaded classes. These do not cause new code
rejection but test shows old values printed.

Adding a line in constructor to re-set value of the test field failed to
work as well. Test still printed value with which the app has been started

Change of method content worked. I can not say at the moment if my prior
issues were due to the field initial values not being handled.

Alex


"Eugene Zhuravlev (JetBrains)" <jeka@intellij.com> wrote in message
news:gh6ogp$r68$1@is.intellij.net...

Alex,

>

In Settings | Debugger | HotSwap set "Reload classes after compilation"
option to "Ask". Change some class and compile.
If reload was successful, IDEA writes in the status bar "N classes
reloaded".
Can you see this message in the status bar after you confirmed reload?

>

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

>



0
Comment actions Permalink

Yes I do see the message (12 classes reloaded some nested classes there)


All the rest is done by jvm. The execution of the modified code as well as actual bytecode substitution is out of IDEA's control. I
cannot say why in this particular example class reloading worked that way, I can only guess why it behaved so. Real answers could
give developers of the jvm.

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Well, I suspect the problem is wrong expectations. In Alex' previous
post I see that he wants to change the initial value of some fields.
IMHO this isn't possible at all. You can only change how the JVM is
EXECUTING some piece of code, but any memory values already assigned
will remain the same regardless of the bytecode which originally was
used to assign them.

Eugene Zhuravlev (JetBrains) wrote:
>> Yes I do see the message (12 classes reloaded some nested classes there)


All the rest is done by jvm. The execution of the modified code as well as actual bytecode substitution is out of IDEA's control. I
cannot say why in this particular example class reloading worked that way, I can only guess why it behaved so. Real answers could
give developers of the jvm.


--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

I agree Martin,
I just wanted to point out again that IDEA does not do "class reloading", but only initiates it.

--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0
Comment actions Permalink

Hello Martin,

What about case where I set value of a field in constructor? That is not
picked up as well. Do you think it is not possible to do as well?

Thanks,
Alex


"Martin Fuhrer" <mf@fuhrer.com> wrote in message
news:gh8jhs$l9k$1@is.intellij.net...

Well, I suspect the problem is wrong expectations. In Alex' previous post
I see that he wants to change the initial value of some fields. IMHO this
isn't possible at all. You can only change how the JVM is EXECUTING some
piece of code, but any memory values already assigned will remain the same
regardless of the bytecode which originally was used to assign them.

>

Eugene Zhuravlev (JetBrains) wrote:

>>> Yes I do see the message (12 classes reloaded some nested classes there)
>>
>> All the rest is done by jvm. The execution of the modified code as well
>> as actual bytecode substitution is out of IDEA's control. I cannot say
>> why in this particular example class reloading worked that way, I can
>> only guess why it behaved so. Real answers could give developers of the
>> jvm.
>>
>

--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com



0
Comment actions Permalink

Alex,
I'm definitely no expert here. IMHO any changes in a constructor should
be picked up, but of course only if you create a new instance after the
hotswap. But then again I can very well imagine that your field won't
get updated correctly, e.g. due to some optimization issues.

Alex Roytman wrote:

Hello Martin,

What about case where I set value of a field in constructor? That is not
picked up as well. Do you think it is not possible to do as well?

Thanks,
Alex


"Martin Fuhrer" <mf@fuhrer.com> wrote in message
news:gh8jhs$l9k$1@is.intellij.net...

>> Well, I suspect the problem is wrong expectations. In Alex' previous post
>> I see that he wants to change the initial value of some fields. IMHO this
>> isn't possible at all. You can only change how the JVM is EXECUTING some
>> piece of code, but any memory values already assigned will remain the same
>> regardless of the bytecode which originally was used to assign them.
>>
>> Eugene Zhuravlev (JetBrains) wrote:
>>>> Yes I do see the message (12 classes reloaded some nested classes there)
>>> All the rest is done by jvm. The execution of the modified code as well
>>> as actual bytecode substitution is out of IDEA's control. I cannot say
>>> why in this particular example class reloading worked that way, I can
>>> only guess why it behaved so. Real answers could give developers of the
>>> jvm.
>>>
>> --
>> Martin Fuhrer
>> Fuhrer Engineering AG
>> http://www.fuhrer.com



--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com

0
Comment actions Permalink

Hi Martin a very good point, I never considered it from instantiated objects
perspective.



"Martin Fuhrer" <mf@fuhrer.com> wrote in message
news:gh92gc$lfo$1@is.intellij.net...

Alex,
I'm definitely no expert here. IMHO any changes in a constructor should be
picked up, but of course only if you create a new instance after the
hotswap. But then again I can very well imagine that your field won't get
updated correctly, e.g. due to some optimization issues.

>

Alex Roytman wrote:

>> Hello Martin,
>>
>> What about case where I set value of a field in constructor? That is not
>> picked up as well. Do you think it is not possible to do as well?
>>
>> Thanks,
>> Alex
>>
>>
>> "Martin Fuhrer" <mf@fuhrer.com> wrote in message
>> news:gh8jhs$l9k$1@is.intellij.net...
>>> Well, I suspect the problem is wrong expectations. In Alex' previous
>>> post I see that he wants to change the initial value of some fields.
>>> IMHO this isn't possible at all. You can only change how the JVM is
>>> EXECUTING some piece of code, but any memory values already assigned
>>> will remain the same regardless of the bytecode which originally was
>>> used to assign them.
>>>
>>> Eugene Zhuravlev (JetBrains) wrote:
>>>>> Yes I do see the message (12 classes reloaded some nested classes
>>>>> there)
>>>> All the rest is done by jvm. The execution of the modified code as well
>>>> as actual bytecode substitution is out of IDEA's control. I cannot say
>>>> why in this particular example class reloading worked that way, I can
>>>> only guess why it behaved so. Real answers could give developers of the
>>>> jvm.
>>>>
>>> --
>>> Martin Fuhrer
>>> Fuhrer Engineering AG
>>> http://www.fuhrer.com
>>
>>
>

--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com



0

Please sign in to leave a comment.