Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException

classic Classic list List threaded Threaded
3 messages Options
abondar abondar
Reply | Threaded
Open this post in threaded view
|

Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException

I am not familiar with this API, but it seems these is a bug in sources of this ignite branch (and in master too)

408: public long[] nextExecutionTimes(int cnt, long start) {
409:    assert cnt > 0;
410:    assert start > 0;
411
412:    if (isDone() || isCancelled())
413:        return EMPTY_TIMES;

436: public long nextExecutionTime() {
437:    return nextExecutionTimes(1, U.currentTimeMillis())[0];
438: }

So in case when (isDone() || isCancelled())==true we have EMPTY_TIMES[0] at line# 437

 
02.02.2016, 05:04, "Steve Scheck" <[hidden email]>:
Hello,
 
When I schedule a schedule a task with IgniteScheduler.scheduleLocal(), then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an exception:
 
                SchedulerFuture schedulerFuture = scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
                long nextExecutionTime = schedulerFuture.nextExecutionTime();
 
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437) ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
 
cronString has the value: {55} 53 3/5 * * * ?
 
Am I doing something wrong here? The JavaDoc has no stipulation on when nextExecutionTime() may be called after a task is scheduled.
 
Thanks.
 
 
 
 
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException

Hi Steve,

This happened because the pattern is invalid. It should be "{55, *} 53 3/5 * * *" (note the second parameter in curly braces). There is an exception because of this which immediately completes the future. Calling nextExecutionTime() on a completed future leads to this exception, which is a bug. I will create a ticket.

-Val

On Mon, Feb 1, 2016 at 9:05 PM, Alexander Bondar <[hidden email]> wrote:
I am not familiar with this API, but it seems these is a bug in sources of this ignite branch (and in master too)

408: public long[] nextExecutionTimes(int cnt, long start) {
409:    assert cnt > 0;
410:    assert start > 0;
411
412:    if (isDone() || isCancelled())
413:        return EMPTY_TIMES;

436: public long nextExecutionTime() {
437:    return nextExecutionTimes(1, U.currentTimeMillis())[0];
438: }

So in case when (isDone() || isCancelled())==true we have EMPTY_TIMES[0] at line# 437

 
02.02.2016, 05:04, "Steve Scheck" <[hidden email]>:
Hello,
 
When I schedule a schedule a task with IgniteScheduler.scheduleLocal(), then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an exception:
 
                SchedulerFuture schedulerFuture = scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
                long nextExecutionTime = schedulerFuture.nextExecutionTime();
 
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437) ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
 
cronString has the value: {55} 53 3/5 * * * ?
 
Am I doing something wrong here? The JavaDoc has no stipulation on when nextExecutionTime() may be called after a task is scheduled.
 
Thanks.
 
 
 
 

vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: SchedulerFuture.nextExecutionTime() throws ArrayIndexOutOfBoundsException


On Mon, Feb 1, 2016 at 9:12 PM, Valentin Kulichenko <[hidden email]> wrote:
Hi Steve,

This happened because the pattern is invalid. It should be "{55, *} 53 3/5 * * *" (note the second parameter in curly braces). There is an exception because of this which immediately completes the future. Calling nextExecutionTime() on a completed future leads to this exception, which is a bug. I will create a ticket.

-Val

On Mon, Feb 1, 2016 at 9:05 PM, Alexander Bondar <[hidden email]> wrote:
I am not familiar with this API, but it seems these is a bug in sources of this ignite branch (and in master too)

408: public long[] nextExecutionTimes(int cnt, long start) {
409:    assert cnt > 0;
410:    assert start > 0;
411
412:    if (isDone() || isCancelled())
413:        return EMPTY_TIMES;

436: public long nextExecutionTime() {
437:    return nextExecutionTimes(1, U.currentTimeMillis())[0];
438: }

So in case when (isDone() || isCancelled())==true we have EMPTY_TIMES[0] at line# 437

 
02.02.2016, 05:04, "Steve Scheck" <[hidden email]>:
Hello,
 
When I schedule a schedule a task with IgniteScheduler.scheduleLocal(), then immediately call SchedulerFuture.nextExecutionTime(), Ignite throws an exception:
 
                SchedulerFuture schedulerFuture = scheduler.scheduleLocal(() -> dispatchNow(job), cronString);
                long nextExecutionTime = schedulerFuture.nextExecutionTime();
 
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:437) ~[ignite-schedule-1.2.0-incubating.jar!/:1.3.0-incubating]
 
cronString has the value: {55} 53 3/5 * * * ?
 
Am I doing something wrong here? The JavaDoc has no stipulation on when nextExecutionTime() may be called after a task is scheduled.
 
Thanks.