Raymond van den Bedum created NIFI-16515:
--------------------------------------------

             Summary: Cron Scheduling Executes Twice After Daylight Saving Time 
Transition (NiFi 2.9.0)
                 Key: NIFI-16515
                 URL: https://issues.apache.org/jira/browse/NIFI-16515
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 2.9.0
            Reporter: Raymond van den Bedum


A GenerateFlowFile processor configured with CRON-driven scheduling executed 
twice on the first Monday following the daylight saving time (DST) transition 
from summer time to standard time.

The processor was already running before the DST transition and had not been 
stopped or restarted.

The configured CRON expression should execute exactly once per weekday at 20:30 
local time. However, two executions occurred one hour apart.
h2. Environment
 * Apache NiFi version: 2.9.0

 * Processor: GenerateFlowFile

 * Scheduling strategy: CRON driven

 * CRON expression: {{0 30 20 ? * MON-FRI}}

 * Timezone: Europe/Amsterdam

 * DST transition: October 25, 2026 (CEST UTC+02:00 to CET UTC+01:00)

 * Processor state: Running continuously before and after the DST transition

h2. Observed Behavior

On Monday, October 26, 2026, the processor generated two FlowFiles:
||Date||Time||Timezone||Event||
|2026-10-26|19:30:02|CET|Unexpected execution|
|2026-10-26|20:30:00|CET|Expected execution|

Both events originated from the same GenerateFlowFile processor.
h2. Expected Behavior

The processor should execute only once per weekday at 20:30 Europe/Amsterdam 
local time, regardless of DST transitions.

The DST transition should not result in an additional execution on the 
following day.
h2. Steps to Reproduce
 # Configure a GenerateFlowFile processor with CRON-driven scheduling.

 # Set the CRON expression to {{{}0 30 20 ? * MON-FRI{}}}.

 # Use the Europe/Amsterdam timezone.

 # Start the processor before the autumn DST transition.

 # Leave the processor running continuously through the transition.

 # Observe the processor executions on the first Monday after the DST 
transition.

h2. Possible Root Cause

The {{CronSchedulingAgent}} implementation appears to use 
{{java.time.OffsetDateTime}} for calculating scheduled execution times.

{{OffsetDateTime}} represents a fixed UTC offset rather than a timezone with 
daylight saving transition rules.

A schedule calculated before the DST transition may retain the previous UTC 
offset, causing the first execution after the transition to occur one hour 
earlier than intended.

After that execution, the scheduler may calculate the next occurrence using the 
new UTC offset, resulting in a second execution on the same day.

This would explain the two observed executions:
 * 20:30 CEST (UTC+02:00), corresponding to 19:30 CET after the transition.

 * 20:30 CET (UTC+01:00), corresponding to the intended local execution time.

This is a suspected root cause based on the available source code and observed 
behavior. It has not yet been confirmed against the exact NiFi 2.9.0 release 
implementation.

Relevant source file:

{{nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/CronSchedulingAgent.java}}
h2. Impact

This behavior may cause CRON-driven processors to execute more than once on the 
first scheduled day after an autumn DST transition.

For scheduled workflows, duplicate executions may result in repeated data 
processing or duplicate downstream operations.
h2. Additional Notes

The processor remained running across the DST transition. The issue was 
observed through two distinct FlowFile creation events approximately one hour 
apart.

No independent reproduction in a test environment has yet been performed.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to