Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cron expression with list (comma) value causes fatal error Opensearch thread due to NoClassDefFoundError when creating snapshot management policy #519

Closed
tomchlee opened this issue Sep 13, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@tomchlee
Copy link

tomchlee commented Sep 13, 2022

Describe the bug
When creating snapshot management policy, I'm able to specify wildcard, range and step values in cron expression. However, when I specify cron expression with list (comma) value, it causes fatal error in Opensearch due to NoClassDefFoundError:

[2022-09-13T17:33:13,207][ERROR][o.o.b.OpenSearchUncaughtExceptionHandler] [node-1] fatal error in thread [Thread-3], exiting
java.lang.NoClassDefFoundError: org/opensearch/jobscheduler/repackage/org/slf4j/LoggerFactory
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.generator.AndFieldValueGenerator.<clinit>(AndFieldValueGenerator.java:27) ~[?:?]
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.generator.FieldValueGeneratorFactory.forCronField(FieldValueGeneratorFactory.java:31) ~[?:?]
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.ExecutionTimeBuilder.forMinutesMatching(ExecutionTimeBuilder.java:57) ~[?:?]
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.ExecutionTime.forCron(ExecutionTime.java:50) ~[?:?]
    at org.opensearch.jobscheduler.spi.schedule.CronSchedule.<init>(CronSchedule.java:48) ~[?:?]
    at org.opensearch.jobscheduler.spi.schedule.ScheduleParser.parse(ScheduleParser.java:50) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.model.SMPolicy$Creation$Companion.parse(SMPolicy.kt:271) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.model.SMPolicy$Companion.parse(SMPolicy.kt:151) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.api.resthandler.RestBaseIndexSMPolicyHandler.prepareIndexRequest(RestBaseIndexSMPolicyHandler.kt:38) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.api.resthandler.RestCreateSMPolicyHandler.prepareRequest(RestCreateSMPolicyHandler.kt:25) ~[?:?]
...

and another similar stacktrace:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.opensearch.jobscheduler.repackage.com.cronutils.model.time.generator.AndFieldValueGenerator
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.generator.FieldValueGeneratorFactory.forCronField(FieldValueGeneratorFactory.java:31) ~[?:?]
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.ExecutionTimeBuilder.forMinutesMatching(ExecutionTimeBuilder.java:57) ~[?:?]
    at org.opensearch.jobscheduler.repackage.com.cronutils.model.time.ExecutionTime.forCron(ExecutionTime.java:50) ~[?:?]
    at org.opensearch.jobscheduler.spi.schedule.CronSchedule.<init>(CronSchedule.java:48) ~[?:?]
    at org.opensearch.jobscheduler.spi.schedule.ScheduleParser.parse(ScheduleParser.java:50) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.model.SMPolicy$Creation$Companion.parse(SMPolicy.kt:271) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.model.SMPolicy$Companion.parse(SMPolicy.kt:151) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.api.resthandler.RestBaseIndexSMPolicyHandler.prepareIndexRequest(RestBaseIndexSMPolicyHandler.kt:38) ~[?:?]
    at org.opensearch.indexmanagement.snapshotmanagement.api.resthandler.RestCreateSMPolicyHandler.prepareRequest(RestCreateSMPolicyHandler.kt:25) ~[?:?]
...

To Reproduce
Steps to reproduce the behavior:

  1. Try to create SM policy via SM api with list value in cron expression, e.g., "0,30 * * * *"
  2. Opensearch process is killed and SM policy failed to be created

Expected behavior
SM policy is created successfully

Plugins
Index Management

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: Linux
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@tomchlee tomchlee added bug Something isn't working untriaged labels Sep 13, 2022
@dblock dblock transferred this issue from opensearch-project/OpenSearch Sep 14, 2022
@bowenlan-amzn
Copy link
Member

bowenlan-amzn commented Oct 19, 2022

Pin down the problem to be the missing slf4j which is the runtime dep of cron-utils.
Fix: opensearch-project/job-scheduler#256

To fix this on your side immediately, please refer to the change in the above PR, build the job scheduler zip manually (./gradlew assemble), and re-install (uninstall & install) the job scheduler plugin to your cluster (install plugin doc)

@tomchlee
Copy link
Author

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants