<#4285 [BUG] FlyteScheduler fired launchplans on r...
# flyte-github
a
#4285 [BUG] FlyteScheduler fired launchplans on redeployment unexpectedly Issue created by leonlnj Describe the bug On FlyteScheduler restart, launchplan were fired unexpectedly. In one redeployment on
2023-10-11T10:29:11Z
, 41 launchplans were fired before schedule time during init of the schdeuler. Observation • All affected launchplan are active • All affected launchplan have never ran before prior to redeployment • Launchplan that was registered together with the affected ones, were not affected if they have a prior run • 41 launchplans were catching up from
2023-10-06 07:28:13.98091
. Using one sample of affected launchplan with version
2cf10a7

image▾

ss 2023-10-16 at 1 36 43 PM copy▾

Filtered logs with startup msg and sample launchplan
Copy code
time="2023-10-11T10:29:11Z" level=info msg="Using config file: [/etc/flyte/config/admin.yaml /etc/flyte/config/db.yaml /etc/flyte/config/logger.yaml /etc/flyte/config/server.yaml]"
{"json":{"src":"service.go:71"},"level":"info","msg":"setting metrics keys to [project domain wf task phase tasktype runtime_type runtime_version app_name]","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"server.go:97"},"level":"info","msg":"Starting profiling server on port [10254]","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"database.go:171"},"level":"info","msg":"Set connection pool values to [{MaxOpenConnections:100 OpenConnections:1 InUse:0 Idle:1 WaitCount:0 WaitDuration:0s MaxIdleClosed:0 MaxIdleTimeClosed:0 MaxLifetimeClosed:0}]","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"client.go:63"},"level":"info","msg":"Initialized Admin client","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"start.go:54"},"level":"info","msg":"Successfully initialized a native flyte scheduler","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"schedule_executor.go:38"},"level":"info","msg":"Flyte native scheduler started successfully","ts":"2023-10-11T10:29:12Z"}
{"json":{"src":"schedule_executor.go:58"},"level":"info","msg":"Number of schedules retrieved 3874","ts":"2023-10-11T10:29:12Z"}

...
{"json":{"src":"gocron_scheduler.go:304"},"level":"info","msg":"successfully added the schedule 6928571252742703947 to the scheduler for schedule {BaseModel:{ID:3854 CreatedAt:2023-10-11 01:27:05.436233 +0000 UTC UpdatedAt:2023-10-11 01:27:05.436233 +0000 UTC DeletedAt:\u003cnil\u003e} SchedulableEntityKey:{Project:... Domain:... Name:...Version:2cf10a7} CronExpression:0 23 * * * FixedRateValue:0 Unit:MINUTE KickoffTimeInputArg:start_date Active:0xc00182a7b4}","ts":"2023-10-11T10:29:12Z"}
...
{"json":{"src":"gocron_scheduler.go:185"},"level":"info","msg":"catching up schedule {BaseModel:{ID:3854 CreatedAt:2023-10-11 01:27:05.436233 +0000 UTC UpdatedAt:2023-10-11 01:27:05.436233 +0000 UTC DeletedAt:\u003cnil\u003e} SchedulableEntityKey:{Project:... Domain:... Name:... Version:2cf10a7} CronExpression:0 23 * * * FixedRateValue:0 Unit:MINUTE KickoffTimeInputArg:start_date Active:0xc00182a7b4} from 2023-10-06 07:28:13.98091 +0000 UTC to 2023-10-11 10:29:12.149534958 +0000 UTC m=+0.286296688","ts":"2023-10-11T10:29:15Z"}
...
{"json":{"src":"executor_impl.go:125"},"level":"info","msg":"successfully fired the request for schedule {BaseModel:{ID:3854 CreatedAt:2023-10-11 01:27:05.436233 +0000 UTC UpdatedAt:2023-10-11 01:27:05.436233 +0000 UTC DeletedAt:\u003cnil\u003e} SchedulableEntityKey:{Project:...Domain:... Name:... Version:2cf10a7} CronExpression:0 23 * * * FixedRateValue:0 Unit:MINUTE KickoffTimeInputArg:start_date Active:0xc00182a7b4} for time 2023-10-06 23:00:00 +0000 UTC","ts":"2023-10-11T10:29:16Z"}
...
{"json":{"src":"gocron_scheduler.go:192"},"level":"info","msg":"caught up successfully on the schedule {BaseModel:{ID:3854 CreatedAt:2023-10-11 01:27:05.436233 +0000 UTC UpdatedAt:2023-10-11 01:27:05.436233 +0000 UTC DeletedAt:\u003cnil\u003e} SchedulableEntityKey:{Project:... Domain:... Name:... Version:2cf10a7} CronExpression:0 23 * * * FixedRateValue:0 Unit:MINUTE KickoffTimeInputArg:start_date Active:0xc00182a7b4} from 2023-10-06 07:28:13.98091 +0000 UTC to 2023-10-11 10:29:12.149534958 +0000 UTC m=+0.286296688","ts":"2023-10-11T10:29:17Z"}
Schedule fired from 6th Oct to 11th Oct

image▾

41 launchplan catching up from 6th Oct (before their creation time)

image▾

Expected behavior Fresh Launchplan should never execute outside scheduled time and scheduler should not run catch with a date before the launchplan creation date. Preferably some guardrail to make sure catchup times start after creation time. Additional context to reproduce Registered new launchplan and restarted scheduler a couple of times in other environment but unable to reproduce this. DB time was checked and it was update to date. Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte