Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Jobs cancelled by JobManagerAdapter?(Jobs cancelled by JobManagerAdapter?)
Jobs cancelled by JobManagerAdapter? [message #792681] Tue, 07 February 2012 09:19 Go to next message
Steffen Gieseler is currently offline Steffen GieselerFriend
Messages: 7
Registered: February 2012
Junior Member
We are using RAP 1.3 R2.

We extensively use jobs for doing background work. Every now and then, it seems without any regular pattern, some jobs are cancelled and cannot be restarted from the GUI, they immediately go back to the CANCEL state.

After some investigation, we found one class that might explain this, but there may be other reasons too: The JobManagerAdapter works with the session management in order to cancel any jobs when their correponding session has expired. Additionally, the JobManagerAdapter adds a listener (JobCanceler()) to that job such that any callback, including scheduled(), immediately cancels the job. However, the error cannot be reproduced reliably.

So here are our questions:
# Is this the real cause for the problem?
# Is it the only cause for the problem?
# How can we schedule a job such that it will never be cancelled, even when the associated session times out? Ideally, we would like to schedule a job that is not associated with a session at all!

Many thanks and best regards,
BitCtrl
Re: Jobs cancelled by JobManagerAdapter? [message #794630 is a reply to message #792681] Thu, 09 February 2012 14:16 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2359
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Steffen,
currently, all jobs are bound to a session in RAP. If you want to
execute something out of a session just use a background thread directly.
Best,
Ivan

On 2/7/2012 11:19 AM, Steffen Gieseler wrote:
> We are using RAP 1.3 R2.
>
> We extensively use jobs for doing background work. Every now and then,
> it seems without any regular pattern, some jobs are cancelled and
> cannot be restarted from the GUI, they immediately go back to the
> CANCEL state.
>
> After some investigation, we found one class that might explain this,
> but there may be other reasons too: The JobManagerAdapter works with
> the session management in order to cancel any jobs when their
> correponding session has expired. Additionally, the JobManagerAdapter
> adds a listener (JobCanceler()) to that job such that any callback,
> including scheduled(), immediately cancels the job. However, the error
> cannot be reproduced reliably.
>
> So here are our questions:
> # Is this the real cause for the problem?
> # Is it the only cause for the problem?
> # How can we schedule a job such that it will never be cancelled, even
> when the associated session times out? Ideally, we would like to
> schedule a job that is not associated with a session at all!
>
> Many thanks and best regards,
> BitCtrl

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Jobs cancelled by JobManagerAdapter? [message #796769 is a reply to message #792681] Sun, 12 February 2012 14:35 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Steffen,

when a Job is scheduled, the the JobManagerAdapter tries to bind it to
the session/display that it is started on. This binding happens if
a) the Job is an instance of UI Job or
b) there is a request-service-context available. The thread that serves
the request is equipped with such a context.

Scheduling a Job without binding it to any session is currently only
possible with a hacky workaround. You'll have to create a thread (or
Job) that just starts the session-independant job. This way the
scheduling thread has no request-service-context attached and the
JobManagerAdapter doesn't find any session to bind the Job to.

Please feel free to file an enhancement request [1] for properly
expressing whether Jobs should be bound to a session or not (maybe by
using Job#setProperty).

HTH
Rüdiger
[1] http://eclipse.org/rap/bugs

On 07.02.2012 10:19, Steffen Gieseler wrote:
> We are using RAP 1.3 R2.
>
> We extensively use jobs for doing background work. Every now and then,
> it seems without any regular pattern, some jobs are cancelled and cannot
> be restarted from the GUI, they immediately go back to the CANCEL state.
>
> After some investigation, we found one class that might explain this,
> but there may be other reasons too: The JobManagerAdapter works with the
> session management in order to cancel any jobs when their correponding
> session has expired. Additionally, the JobManagerAdapter adds a listener
> (JobCanceler()) to that job such that any callback, including
> scheduled(), immediately cancels the job. However, the error cannot be
> reproduced reliably.
>
> So here are our questions:
> # Is this the real cause for the problem?
> # Is it the only cause for the problem?
> # How can we schedule a job such that it will never be cancelled, even
> when the associated session times out? Ideally, we would like to
> schedule a job that is not associated with a session at all!
>
> Many thanks and best regards,
> BitCtrl

--
Rüdiger Herrmann
http://codeaffine.com
Re: Jobs cancelled by JobManagerAdapter? [message #797391 is a reply to message #796769] Mon, 13 February 2012 12:30 Go to previous messageGo to next message
Steffen Gieseler is currently offline Steffen GieselerFriend
Messages: 7
Registered: February 2012
Junior Member
Many thanks for the reply.
Could you explain the conditions that lead to cancellation of the job by the JobManagerAdapter?
For me it seems that a session timeout or closed session (closed browser) does not cancel a bound job in every case. In other words, I could not reproduce the cancellation in a predictable way.

Steffen
Re: Jobs cancelled by JobManagerAdapter? [message #798200 is a reply to message #797391] Tue, 14 February 2012 11:21 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Steffen,

every job that is bound to a session is cancelled (Job#cancel()) when
the session terminates.

I can think of three things that prevent a job from being cancelled at
the end of a session:
a) the job is not bound to a session in the first place because there is
no request-service context available when the job is scheduled. I.e. it
is re-scheduled or started from within a Job.
b) there is no way to force a job to terminate from the outside.
Job#cancel() just sets a flag that must be evaluated by the job.
c) there is a bug that prevents proper job-cancelation. If you find a
bug please report it with steps (and ideally some code) to reproduce.

HTH
Rüdiger

On 13.02.2012 13:30, Steffen Gieseler wrote:
> Many thanks for the reply.
> Could you explain the conditions that lead to cancellation of the job by
> the JobManagerAdapter? For me it seems that a session timeout or closed
> session (closed browser) does not cancel a bound job in every case. In
> other words, I could not reproduce the cancellation in a predictable way.
>
> Steffen
>

--
Rüdiger Herrmann
http://codeaffine.com
Re: Jobs cancelled by JobManagerAdapter? [message #798307 is a reply to message #796769] Tue, 14 February 2012 14:18 Go to previous messageGo to next message
Steffen Gieseler is currently offline Steffen GieselerFriend
Messages: 7
Registered: February 2012
Junior Member
Rüdiger,

this answers a part of my questions. Point a) explains why my self-re-scheduling jobs are not affected but only the jobs that run for a long time.
Unfortunately I can't give you steps to reproduce. What I have found in my code is that the reason for the cancellation is the JobCanceler(). It is attached as listener in JobManagerAdapter$HttpSessionBindungListener#handleWatchdog() (the only place I found).
But I found no reproducable way to call this method (respectively HttpSessionBindungListener#valueUnbound()) when a session terminates.
In almost all of my debug-sessions the calling SessionStoreImpl#valueUnbound() either has a 'shutdownAdapter != null' or there are no listeners in SessionStoreImpl#dovalueUnbound().

Thanks,

Steffen

Re: Jobs cancelled by JobManagerAdapter? [message #799729 is a reply to message #798307] Thu, 16 February 2012 08:32 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member
Steffen,

just to clarify, you want to start jobs that are not bound to any
session at all. Is that right?
If so, you have to make sure that there is no request-service context
available on the thread that schedules the job (see also my previous reply).
The JobCanceler indicates that the job is already bound to a session. In
this case you cannot unbind the job or otherwise prevent the job from
being canceled at the end of the session.

BTW, the 'shutdownAdapter != null' is just a detour that first
terminates the UI-thread and then should also end in
SessionStoreImpl#doValueUnbound().

Regards,
Rüdiger

On 14.02.2012 15:18, Steffen Gieseler wrote:
> Rüdiger,
>
> this answers a part of my questions. Point a) explains why my
> self-re-scheduling jobs are not affected but only the jobs that run for
> a long time.
> Unfortunately I can't give you steps to reproduce. What I have found in
> my code is that the reason for the cancellation is the JobCanceler(). It
> is attached as listener in
> JobManagerAdapter$HttpSessionBindungListener#handleWatchdog() (the only
> place I found). But I found no reproducable way to call this method
> (respectively HttpSessionBindungListener#valueUnbound()) when a session
> terminates.
> In almost all of my debug-sessions the calling
> SessionStoreImpl#valueUnbound() either has a 'shutdownAdapter != null'
> or there are no listeners in SessionStoreImpl#dovalueUnbound().
>
> Thanks,
>
> Steffen
>
>
--
Rüdiger Herrmann
http://codeaffine.com
Re: Jobs cancelled by JobManagerAdapter? [message #799754 is a reply to message #799729] Thu, 16 February 2012 09:19 Go to previous message
Steffen Gieseler is currently offline Steffen GieselerFriend
Messages: 7
Registered: February 2012
Junior Member
Rüdiger,

thanks for the reply.
I currently working on the re-implementation of the jobs as background threads. The reason for not using your 'hacky workaround' is another problem with the JobManager we had in the past (I will create a new discussion for this).

At this time my problem is as follows: Our application is in production use (with the job problem). Until I release the update I have to explain under which conditions the problem occurs.

Thanks,

Steffen
Previous Topic:IE8: 'object' is null or not an object
Next Topic:RAP Dependency Versions
Goto Forum:
  


Current Time: Tue Oct 26 14:10:13 GMT 2021

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

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

Back to the top