You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Tomek <to...@wp.pl> on 2022/04/11 19:27:12 UTC

Scheduled job problem

Hi,

I have created a job:

<TemporalExpression tempExprId="partial-update-offer"
                         tempExprTypeId="FREQUENCY"
                         description="Every 5 minutes"
                         integer1="12"
                         integer2="5"/>

<JobSandbox jobId="partial-update-offer"
                         jobName="Partial update offer"
                         runTime="2021-12-15 14:36:00.00"
                         serviceName="partialUpdateOfferJob"
                         poolId="pool"
                         runAsUser="system"
                         tempExprId="partial-update-offer"
                         maxRecurrenceCount="-1"/>

I would like to run partialUpdateOfferJob service every 5 minutes. In 
the beginning every thing is ok but after some time the service is 
running two (or even more) times at similar time. Here is a part of my 
data stored in job_sandbox table:

job_id    job_name                run_time status_id             
parent_job_id
269925    Partial update offer    2022-04-11 17:12:44.883000 
SERVICE_QUEUED         partial-update-offer
269924    Partial update offer    2022-04-11 17:12:44.686000 
SERVICE_QUEUED         partial-update-offer
269923    Partial update offer    2022-04-11 17:12:44.526000 
SERVICE_QUEUED         partial-update-offer
269897    Partial update offer    2022-04-11 16:12:52.199000 
SERVICE_FINISHED         partial-update-offer
269896    Partial update offer    2022-04-11 16:12:52.049000 
SERVICE_FINISHED         partial-update-offer
269895    Partial update offer    2022-04-11 16:12:51.800000 
SERVICE_FINISHED         partial-update-offer
269880    Partial update offer    2022-04-11 15:33:06.260000 
SERVICE_FINISHED         partial-update-offer
269879    Partial update offer    2022-04-11 15:32:55.404000 
SERVICE_FINISHED         partial-update-offer
269878    Partial update offer    2022-04-11 15:32:55.201000 
SERVICE_FINISHED         partial-update-offer
269851    Partial update offer    2022-04-11 14:53:05.134000 
SERVICE_FINISHED         partial-update-offer

How can i repair it?

BTW: why the service is running at irregular time period?


Re: Scheduled job problem

Posted by Scott Gray <sc...@hotwaxsystems.com>.
I don't think that would cause this problem, the next occurrence of a job
is scheduled when the current job is queued (or started, I can't remember
exactly) so generally the runTime values should be roughly 5 minutes apart
regardless of how long the job takes to run.  Some time is lost between
creating a job and it being polled/queued so the interval between jobs will
always be slightly more than 5 minutes.

More common reasons for duplicate jobs can be:
1. The job is being loaded via entity XML more than once
2. A bug in the job manager code could allow duplicates to occur in some
situations (usually if shutting down the instance while the job is being
queued, due to incorrect transaction management).

Regards
Scott


On Mon, 11 Apr 2022 at 21:33, Michael Brohl <mi...@ecomify.de>
wrote:

> Hi,
>
> is it possible that your job run time is longer than the 5 minutes
> scheduling interval and it is not configured against parallel execution?
>
> If yes, consider using the semaphore settings for your service (see [1]).
>
> Best regards,
>
> Michael Brohl
>
> ecomify GmbH - www.ecomify.de
>
>
> [1]
>
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=7045171#ServiceEngineGuide-serviceDefinition
>
>
>
> Am 11.04.22 um 21:27 schrieb Tomek:
> > Hi,
> >
> > I have created a job:
> >
> > <TemporalExpression tempExprId="partial-update-offer"
> >                         tempExprTypeId="FREQUENCY"
> >                         description="Every 5 minutes"
> >                         integer1="12"
> >                         integer2="5"/>
> >
> > <JobSandbox jobId="partial-update-offer"
> >                         jobName="Partial update offer"
> >                         runTime="2021-12-15 14:36:00.00"
> >                         serviceName="partialUpdateOfferJob"
> >                         poolId="pool"
> >                         runAsUser="system"
> >                         tempExprId="partial-update-offer"
> >                         maxRecurrenceCount="-1"/>
> >
> > I would like to run partialUpdateOfferJob service every 5 minutes. In
> > the beginning every thing is ok but after some time the service is
> > running two (or even more) times at similar time. Here is a part of my
> > data stored in job_sandbox table:
> >
> > job_id    job_name                run_time status_id parent_job_id
> > 269925    Partial update offer    2022-04-11 17:12:44.883000
> > SERVICE_QUEUED         partial-update-offer
> > 269924    Partial update offer    2022-04-11 17:12:44.686000
> > SERVICE_QUEUED         partial-update-offer
> > 269923    Partial update offer    2022-04-11 17:12:44.526000
> > SERVICE_QUEUED         partial-update-offer
> > 269897    Partial update offer    2022-04-11 16:12:52.199000
> > SERVICE_FINISHED         partial-update-offer
> > 269896    Partial update offer    2022-04-11 16:12:52.049000
> > SERVICE_FINISHED         partial-update-offer
> > 269895    Partial update offer    2022-04-11 16:12:51.800000
> > SERVICE_FINISHED         partial-update-offer
> > 269880    Partial update offer    2022-04-11 15:33:06.260000
> > SERVICE_FINISHED         partial-update-offer
> > 269879    Partial update offer    2022-04-11 15:32:55.404000
> > SERVICE_FINISHED         partial-update-offer
> > 269878    Partial update offer    2022-04-11 15:32:55.201000
> > SERVICE_FINISHED         partial-update-offer
> > 269851    Partial update offer    2022-04-11 14:53:05.134000
> > SERVICE_FINISHED         partial-update-offer
> >
> > How can i repair it?
> >
> > BTW: why the service is running at irregular time period?
> >
>

Re: Scheduled job problem

Posted by Tomek <to...@wp.pl>.
Unfortunelly the problem still occurs.

I load the seed data (my job definition is part of seed data) every 
time, before I launching the Ofbiz. As far as I know, the OFBiz delete 
rows from the job_sandbox table sometimes. So, sometime I insert new 
record into job_sandbox table after the Ofbiz delete some rows in the 
same table. It is possible that the problem is connected with it?

On 11.04.2022 23:27, Tomek wrote:
> Thank you for your response.
>
> I think it is possible that the service run time is longer than the 5 
> minutes. So, I try to use the semaphore settings. I hope that solve my 
> problem :)
>
> Tomek
>
>
> On 11.04.2022 22:33, Michael Brohl wrote:
>> Hi,
>>
>> is it possible that your job run time is longer than the 5 minutes 
>> scheduling interval and it is not configured against parallel execution?
>>
>> If yes, consider using the semaphore settings for your service (see 
>> [1]).
>>
>> Best regards,
>>
>> Michael Brohl
>>
>> ecomify GmbH - www.ecomify.de
>>
>>
>> [1] 
>> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=7045171#ServiceEngineGuide-serviceDefinition
>>
>>
>>
>> Am 11.04.22 um 21:27 schrieb Tomek:
>>> Hi,
>>>
>>> I have created a job:
>>>
>>> <TemporalExpression tempExprId="partial-update-offer"
>>>                         tempExprTypeId="FREQUENCY"
>>>                         description="Every 5 minutes"
>>>                         integer1="12"
>>>                         integer2="5"/>
>>>
>>> <JobSandbox jobId="partial-update-offer"
>>>                         jobName="Partial update offer"
>>>                         runTime="2021-12-15 14:36:00.00"
>>>                         serviceName="partialUpdateOfferJob"
>>>                         poolId="pool"
>>>                         runAsUser="system"
>>>                         tempExprId="partial-update-offer"
>>>                         maxRecurrenceCount="-1"/>
>>>
>>> I would like to run partialUpdateOfferJob service every 5 minutes. 
>>> In the beginning every thing is ok but after some time the service 
>>> is running two (or even more) times at similar time. Here is a part 
>>> of my data stored in job_sandbox table:
>>>
>>> job_id    job_name                run_time status_id parent_job_id
>>> 269925    Partial update offer    2022-04-11 17:12:44.883000 
>>> SERVICE_QUEUED         partial-update-offer
>>> 269924    Partial update offer    2022-04-11 17:12:44.686000 
>>> SERVICE_QUEUED         partial-update-offer
>>> 269923    Partial update offer    2022-04-11 17:12:44.526000 
>>> SERVICE_QUEUED         partial-update-offer
>>> 269897    Partial update offer    2022-04-11 16:12:52.199000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269896    Partial update offer    2022-04-11 16:12:52.049000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269895    Partial update offer    2022-04-11 16:12:51.800000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269880    Partial update offer    2022-04-11 15:33:06.260000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269879    Partial update offer    2022-04-11 15:32:55.404000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269878    Partial update offer    2022-04-11 15:32:55.201000 
>>> SERVICE_FINISHED         partial-update-offer
>>> 269851    Partial update offer    2022-04-11 14:53:05.134000 
>>> SERVICE_FINISHED         partial-update-offer
>>>
>>> How can i repair it?
>>>
>>> BTW: why the service is running at irregular time period?
>>>

Re: Scheduled job problem

Posted by Tomek <to...@wp.pl>.
Thank you for your response.

I think it is possible that the service run time is longer than the 5 
minutes. So, I try to use the semaphore settings. I hope that solve my 
problem :)

Tomek


On 11.04.2022 22:33, Michael Brohl wrote:
> Hi,
>
> is it possible that your job run time is longer than the 5 minutes 
> scheduling interval and it is not configured against parallel execution?
>
> If yes, consider using the semaphore settings for your service (see [1]).
>
> Best regards,
>
> Michael Brohl
>
> ecomify GmbH - www.ecomify.de
>
>
> [1] 
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=7045171#ServiceEngineGuide-serviceDefinition
>
>
>
> Am 11.04.22 um 21:27 schrieb Tomek:
>> Hi,
>>
>> I have created a job:
>>
>> <TemporalExpression tempExprId="partial-update-offer"
>>                         tempExprTypeId="FREQUENCY"
>>                         description="Every 5 minutes"
>>                         integer1="12"
>>                         integer2="5"/>
>>
>> <JobSandbox jobId="partial-update-offer"
>>                         jobName="Partial update offer"
>>                         runTime="2021-12-15 14:36:00.00"
>>                         serviceName="partialUpdateOfferJob"
>>                         poolId="pool"
>>                         runAsUser="system"
>>                         tempExprId="partial-update-offer"
>>                         maxRecurrenceCount="-1"/>
>>
>> I would like to run partialUpdateOfferJob service every 5 minutes. In 
>> the beginning every thing is ok but after some time the service is 
>> running two (or even more) times at similar time. Here is a part of 
>> my data stored in job_sandbox table:
>>
>> job_id    job_name                run_time status_id parent_job_id
>> 269925    Partial update offer    2022-04-11 17:12:44.883000 
>> SERVICE_QUEUED         partial-update-offer
>> 269924    Partial update offer    2022-04-11 17:12:44.686000 
>> SERVICE_QUEUED         partial-update-offer
>> 269923    Partial update offer    2022-04-11 17:12:44.526000 
>> SERVICE_QUEUED         partial-update-offer
>> 269897    Partial update offer    2022-04-11 16:12:52.199000 
>> SERVICE_FINISHED         partial-update-offer
>> 269896    Partial update offer    2022-04-11 16:12:52.049000 
>> SERVICE_FINISHED         partial-update-offer
>> 269895    Partial update offer    2022-04-11 16:12:51.800000 
>> SERVICE_FINISHED         partial-update-offer
>> 269880    Partial update offer    2022-04-11 15:33:06.260000 
>> SERVICE_FINISHED         partial-update-offer
>> 269879    Partial update offer    2022-04-11 15:32:55.404000 
>> SERVICE_FINISHED         partial-update-offer
>> 269878    Partial update offer    2022-04-11 15:32:55.201000 
>> SERVICE_FINISHED         partial-update-offer
>> 269851    Partial update offer    2022-04-11 14:53:05.134000 
>> SERVICE_FINISHED         partial-update-offer
>>
>> How can i repair it?
>>
>> BTW: why the service is running at irregular time period?
>>

Re: Scheduled job problem

Posted by Michael Brohl <mi...@ecomify.de>.
Hi,

is it possible that your job run time is longer than the 5 minutes 
scheduling interval and it is not configured against parallel execution?

If yes, consider using the semaphore settings for your service (see [1]).

Best regards,

Michael Brohl

ecomify GmbH - www.ecomify.de


[1] 
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=7045171#ServiceEngineGuide-serviceDefinition



Am 11.04.22 um 21:27 schrieb Tomek:
> Hi,
>
> I have created a job:
>
> <TemporalExpression tempExprId="partial-update-offer"
>                         tempExprTypeId="FREQUENCY"
>                         description="Every 5 minutes"
>                         integer1="12"
>                         integer2="5"/>
>
> <JobSandbox jobId="partial-update-offer"
>                         jobName="Partial update offer"
>                         runTime="2021-12-15 14:36:00.00"
>                         serviceName="partialUpdateOfferJob"
>                         poolId="pool"
>                         runAsUser="system"
>                         tempExprId="partial-update-offer"
>                         maxRecurrenceCount="-1"/>
>
> I would like to run partialUpdateOfferJob service every 5 minutes. In 
> the beginning every thing is ok but after some time the service is 
> running two (or even more) times at similar time. Here is a part of my 
> data stored in job_sandbox table:
>
> job_id    job_name                run_time status_id parent_job_id
> 269925    Partial update offer    2022-04-11 17:12:44.883000 
> SERVICE_QUEUED         partial-update-offer
> 269924    Partial update offer    2022-04-11 17:12:44.686000 
> SERVICE_QUEUED         partial-update-offer
> 269923    Partial update offer    2022-04-11 17:12:44.526000 
> SERVICE_QUEUED         partial-update-offer
> 269897    Partial update offer    2022-04-11 16:12:52.199000 
> SERVICE_FINISHED         partial-update-offer
> 269896    Partial update offer    2022-04-11 16:12:52.049000 
> SERVICE_FINISHED         partial-update-offer
> 269895    Partial update offer    2022-04-11 16:12:51.800000 
> SERVICE_FINISHED         partial-update-offer
> 269880    Partial update offer    2022-04-11 15:33:06.260000 
> SERVICE_FINISHED         partial-update-offer
> 269879    Partial update offer    2022-04-11 15:32:55.404000 
> SERVICE_FINISHED         partial-update-offer
> 269878    Partial update offer    2022-04-11 15:32:55.201000 
> SERVICE_FINISHED         partial-update-offer
> 269851    Partial update offer    2022-04-11 14:53:05.134000 
> SERVICE_FINISHED         partial-update-offer
>
> How can i repair it?
>
> BTW: why the service is running at irregular time period?
>