Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Questions on session invalidate process
Questions on session invalidate process [message #130612] Tue, 28 April 2009 14:43 Go to next message
Loïc Bertholet is currently offline Loïc BertholetFriend
Messages: 57
Registered: July 2009
Member
Hi all,

When session is unvalidated (thanks to time out or
RWT.getSessionStore().getHttpSession().setMaxInactiveInterva l(1)) the
Workbench is closed thanks to a SessionStoreListener.

But the process is not exactly the same as when it is closed thanks to the
workbench red cross button. I've observed 2 differences.

- First of all the ServiceContext is not disposed so that it still
contains the stateInfo.

- Then the stateInfo have in its attributes the WorkbenchThemeManager
whose the manager still has, in its listenerList, references to
ThemeManagerAdapter.
These references are still available because in case of invalidation there
is no phase and listeners are not detached (see TypeEvent.processEvent()).

Are these behavior wanted ? Can they be changed ?

The main problem behind is that sometimes the ThemeManagerAdpater have
reference to the EditorStack and so to the WorkbenchWindow and so to the
Workbench and its Advisors...

And in my application I use BIRT which uses EMF XMLTypeUtil classes which
can hold static reference on the same Thread as the one holding the not
disposed ServiceContext... a huge memory leak happened, nothing of my
application is garbage collected !

Do you have suggestion in order to avoid it ?

Thanks,

Loïc
Re: Questions on session invalidate process [message #130783 is a reply to message #130612] Wed, 29 April 2009 12:31 Go to previous messageGo to next message
Loïc Bertholet is currently offline Loïc BertholetFriend
Messages: 57
Registered: July 2009
Member
Hello,

I try to find a workaround by adding the following code in my
WorkbenchAdvisor.preShutdown() method :

if (ContextProvider.getContext() != null && CurrentPhase.get() ==
null)
{
ContextProvider.getStateInfo().setAttribute(
CurrentPhase.class.getName() + "#value",
PhaseId.PROCESS_ACTION);
}

Not very nice and not efficient.
Well, the WorkbenchThemeManager releases its references to
ThemeManagerAdapter but what I didn't realize is that the
ServiceContext.stateInfo has directly in its attribute the Workbench.

So as long as the ServiceContext is not disposed all the application
classes are not released because of the XMLTypeUtil link to the Thread.

I try to call ContextProvider.disposeContext() during
WorkbenchAdvisor.preShutdown() but then I get "No context available
outside of the request service lifecycle" error during
serviceLocator.dispose() and workbenchActivitySupport.dispose()...

The best way to solve my problem is to call
ContextProvider.disposeContext() at the end of UIThread.processShutdown()
but it's a RAP class and I don't know if it may involve regression.

Does anybody have an idea how I can solve this problem ?

Thanks,

Loïc

Loïc Bertholet wrote:

> Hi all,

> When session is unvalidated (thanks to time out or
> RWT.getSessionStore().getHttpSession().setMaxInactiveInterva l(1)) the
> Workbench is closed thanks to a SessionStoreListener.

> But the process is not exactly the same as when it is closed thanks to the
> workbench red cross button. I've observed 2 differences.

> - First of all the ServiceContext is not disposed so that it still
> contains the stateInfo.

> - Then the stateInfo have in its attributes the WorkbenchThemeManager
> whose the manager still has, in its listenerList, references to
> ThemeManagerAdapter.
> These references are still available because in case of invalidation there
> is no phase and listeners are not detached (see TypeEvent.processEvent()).

> Are these behavior wanted ? Can they be changed ?

> The main problem behind is that sometimes the ThemeManagerAdpater have
> reference to the EditorStack and so to the WorkbenchWindow and so to the
> Workbench and its Advisors...

> And in my application I use BIRT which uses EMF XMLTypeUtil classes which
> can hold static reference on the same Thread as the one holding the not
> disposed ServiceContext... a huge memory leak happened, nothing of my
> application is garbage collected !

> Do you have suggestion in order to avoid it ?

> Thanks,

> Loïc
Re: Questions on session invalidate process [message #130949 is a reply to message #130612] Sun, 03 May 2009 17:24 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Loïc,

please see my comments below.

Cheers,
Rüdiger

Loïc Bertholet wrote:
> Hi all,
>
> When session is unvalidated (thanks to time out or
> RWT.getSessionStore().getHttpSession().setMaxInactiveInterva l(1)) the
> Workbench is closed thanks to a SessionStoreListener.
>
> But the process is not exactly the same as when it is closed thanks to
> the workbench red cross button. I've observed 2 differences.
>
> - First of all the ServiceContext is not disposed so that it still
> contains the stateInfo.
Not sure if I understand the case correctly. As only the terminated
UI thread holds a reference to the state info, it should be garbage
collected. If you disagree of I am missing something, feel free to
file a bugzilla.

>
> - Then the stateInfo have in its attributes the WorkbenchThemeManager
> whose the manager still has, in its listenerList, references to
> ThemeManagerAdapter.
> These references are still available because in case of invalidation
> there is no phase and listeners are not detached (see
> TypeEvent.processEvent()).
I would regard this a bug. The session shutdown should probably
behave like the PROCESS_ACTION phase. Feel free to file a bugzilla.

>
> Are these behavior wanted ? Can they be changed ?
>
> The main problem behind is that sometimes the ThemeManagerAdpater have
> reference to the EditorStack and so to the WorkbenchWindow and so to the
> Workbench and its Advisors...
>
> And in my application I use BIRT which uses EMF XMLTypeUtil classes
> which can hold static reference on the same Thread as the one holding
> the not disposed ServiceContext... a huge memory leak happened, nothing
> of my application is garbage collected !
>
> Do you have suggestion in order to avoid it ?
>
> Thanks,
>
> Loïc
>
Re: Questions on session invalidate process [message #131622 is a reply to message #130949] Wed, 06 May 2009 16:12 Go to previous messageGo to next message
Loïc Bertholet is currently offline Loïc BertholetFriend
Messages: 57
Registered: July 2009
Member
Rüdiger,

Thanks for your answers.

You are right, as only the terminated UI thread holds a reference to the
state info, it should be garbage collected.

But as I said, my application uses BIRT which uses EMF XMLTypeUtil class
which sometimes holds a static reference on this terminated UI thread. So
it is not garbage collected and as the ServiceContext is not disposed
nothing of my application is garbage collected (state info hold a
reference to the Workbench).

I was wondering if there was a reason not calling
ContextProvider.disposeContext() at the end of UIThread.processShutdown(),
just like it is done at the end of RWTDelegate.doPost().
It is the only workaround I found but I don't know if it may involve
regression.

Concerning the second point, you've just fixed it thanks to the last
commit resolving the Bug #262220 (Invalid Thread Access).

Thanks,

Loïc

Rüdiger Herrmann wrote:

> Loïc,

> please see my comments below.

> Cheers,
> Rüdiger

> Loïc Bertholet wrote:
>> Hi all,
>>
>> When session is unvalidated (thanks to time out or
>> RWT.getSessionStore().getHttpSession().setMaxInactiveInterva l(1)) the
>> Workbench is closed thanks to a SessionStoreListener.
>>
>> But the process is not exactly the same as when it is closed thanks to
>> the workbench red cross button. I've observed 2 differences.
>>
>> - First of all the ServiceContext is not disposed so that it still
>> contains the stateInfo.
> Not sure if I understand the case correctly. As only the terminated
> UI thread holds a reference to the state info, it should be garbage
> collected. If you disagree of I am missing something, feel free to
> file a bugzilla.

>>
>> - Then the stateInfo have in its attributes the WorkbenchThemeManager
>> whose the manager still has, in its listenerList, references to
>> ThemeManagerAdapter.
>> These references are still available because in case of invalidation
>> there is no phase and listeners are not detached (see
>> TypeEvent.processEvent()).
> I would regard this a bug. The session shutdown should probably
> behave like the PROCESS_ACTION phase. Feel free to file a bugzilla.

>>
>> Are these behavior wanted ? Can they be changed ?
>>
>> The main problem behind is that sometimes the ThemeManagerAdpater have
>> reference to the EditorStack and so to the WorkbenchWindow and so to the
>> Workbench and its Advisors...
>>
>> And in my application I use BIRT which uses EMF XMLTypeUtil classes
>> which can hold static reference on the same Thread as the one holding
>> the not disposed ServiceContext... a huge memory leak happened, nothing
>> of my application is garbage collected !
>>
>> Do you have suggestion in order to avoid it ?
>>
>> Thanks,
>>
>> Loïc
>>
Re: Questions on session invalidate process [message #131697 is a reply to message #131622] Thu, 07 May 2009 09:45 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Loïc Bertholet wrote:
> Rüdiger,
>
> Thanks for your answers.
>
> You are right, as only the terminated UI thread holds a reference to the
> state info, it should be garbage collected.
>
> But as I said, my application uses BIRT which uses EMF XMLTypeUtil class
> which sometimes holds a static reference on this terminated UI thread.
> So it is not garbage collected and as the ServiceContext is not disposed
> nothing of my application is garbage collected (state info hold a
> reference to the Workbench).
>
> I was wondering if there was a reason not calling
> ContextProvider.disposeContext() at the end of
> UIThread.processShutdown(), just like it is done at the end of
> RWTDelegate.doPost().
> It is the only workaround I found but I don't know if it may involve
> regression.
I see that in your case this might cause a memory leak. Please open
a bugzilla in order to consider how to fix this.

>
> Concerning the second point, you've just fixed it thanks to the last
> commit resolving the Bug #262220 (Invalid Thread Access).
>
> Thanks,
>
> Loïc
>
> Rüdiger Herrmann wrote:
>
>> Loïc,
>
>> please see my comments below.
>
>> Cheers,
>> Rüdiger
>
>> Loïc Bertholet wrote:
>>> Hi all,
>>>
>>> When session is unvalidated (thanks to time out or
>>> RWT.getSessionStore().getHttpSession().setMaxInactiveInterva l(1)) the
>>> Workbench is closed thanks to a SessionStoreListener.
>>>
>>> But the process is not exactly the same as when it is closed thanks
>>> to the workbench red cross button. I've observed 2 differences.
>>>
>>> - First of all the ServiceContext is not disposed so that it still
>>> contains the stateInfo.
>> Not sure if I understand the case correctly. As only the terminated UI
>> thread holds a reference to the state info, it should be garbage
>> collected. If you disagree of I am missing something, feel free to
>> file a bugzilla.
>
>>>
>>> - Then the stateInfo have in its attributes the WorkbenchThemeManager
>>> whose the manager still has, in its listenerList, references to
>>> ThemeManagerAdapter.
>>> These references are still available because in case of invalidation
>>> there is no phase and listeners are not detached (see
>>> TypeEvent.processEvent()).
>> I would regard this a bug. The session shutdown should probably behave
>> like the PROCESS_ACTION phase. Feel free to file a bugzilla.
>
>>>
>>> Are these behavior wanted ? Can they be changed ?
>>>
>>> The main problem behind is that sometimes the ThemeManagerAdpater
>>> have reference to the EditorStack and so to the WorkbenchWindow and
>>> so to the Workbench and its Advisors...
>>>
>>> And in my application I use BIRT which uses EMF XMLTypeUtil classes
>>> which can hold static reference on the same Thread as the one holding
>>> the not disposed ServiceContext... a huge memory leak happened,
>>> nothing of my application is garbage collected !
>>>
>>> Do you have suggestion in order to avoid it ?
>>>
>>> Thanks,
>>>
>>> Loïc
>>>
>
>
Re: Questions on session invalidate process [message #131753 is a reply to message #131697] Thu, 07 May 2009 16:29 Go to previous message
Loïc Bertholet is currently offline Loïc BertholetFriend
Messages: 57
Registered: July 2009
Member
Done : https://bugs.eclipse.org/bugs/show_bug.cgi?id=275332

Rüdiger Herrmann wrote:


> Loïc Bertholet wrote:
>> Rüdiger,
>>
>> Thanks for your answers.
>>
>> You are right, as only the terminated UI thread holds a reference to the
>> state info, it should be garbage collected.
>>
>> But as I said, my application uses BIRT which uses EMF XMLTypeUtil class
>> which sometimes holds a static reference on this terminated UI thread.
>> So it is not garbage collected and as the ServiceContext is not disposed
>> nothing of my application is garbage collected (state info hold a
>> reference to the Workbench).
>>
>> I was wondering if there was a reason not calling
>> ContextProvider.disposeContext() at the end of
>> UIThread.processShutdown(), just like it is done at the end of
>> RWTDelegate.doPost().
>> It is the only workaround I found but I don't know if it may involve
>> regression.
> I see that in your case this might cause a memory leak. Please open
> a bugzilla in order to consider how to fix this.
Previous Topic:Icons in TreeViewer
Next Topic:JFace OpenStrategy
Goto Forum:
  


Current Time: Wed Dec 01 21:28:11 GMT 2021

Powered by FUDForum. Page generated in 0.01446 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top