Skip to content

Conversation

@weizhouapache
Copy link
Member

Description

This PR fixes #11564

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@weizhouapache weizhouapache added this to the 4.20.2 milestone Sep 4, 2025
@weizhouapache weizhouapache linked an issue Sep 4, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.17%. Comparing base (db5b6a5) to head (4cd164d).
⚠️ Report is 27 commits behind head on 4.20.

Files with missing lines Patch % Lines
...cloud/cluster/dao/ManagementServerHostDaoImpl.java 0.00% 11 Missing ⚠️
...apache/cloudstack/vm/schedule/VMSchedulerImpl.java 0.00% 4 Missing ⚠️
...che/cloudstack/mom/webhook/WebhookServiceImpl.java 0.00% 1 Missing ⚠️
.../cloud/resourcelimit/ResourceLimitManagerImpl.java 0.00% 1 Missing ⚠️
...loudstack/resource/ResourceCleanupServiceImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               4.20   #11573    +/-   ##
==========================================
  Coverage     16.17%   16.17%            
- Complexity    13286    13299    +13     
==========================================
  Files          5656     5656            
  Lines        498015   498162   +147     
  Branches      60406    60443    +37     
==========================================
+ Hits          80538    80589    +51     
- Misses       408515   408602    +87     
- Partials       8962     8971     +9     
Flag Coverage Δ
uitests 4.00% <ø> (-0.01%) ⬇️
unittests 17.03% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. One comment

@shwstppr
Copy link
Contributor

shwstppr commented Sep 4, 2025

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14843

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14849

@shwstppr
Copy link
Contributor

shwstppr commented Sep 7, 2025

@blueorangutan test

@blueorangutan
Copy link

@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-14233)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 52446 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11573-t14233-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@weizhouapache
Copy link
Member Author

@vishesh92
I added a new method to get mgmt server based on the class name, it could be used in other places too

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good to me

@weizhouapache
Copy link
Member Author

@vishesh92
can you please test this PR when you have time ? thanks

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14975

@vishesh92
Copy link
Member

vishesh92 commented Sep 15, 2025

@weizhouapache I created two schedules like below on a single VM and I am still seeing the DB Exception in the logs. The execution of the schedules is happening only one server now.

2025-09-15 06:00:35,388 ERROR [o.a.c.v.s.d.VMScheduledJobDaoImpl] (VMSchedulerPollTask:[ctx-1d917c1b]) (logid:44f16569) DB Exception on: HikariProxyPreparedStatement@135121997 wrapping com.mysql.cj.jdbc.ServerPreparedStatement[368]: INSERT INTO vm_scheduled_job (vm_scheduled_job.uuid, vm_scheduled_job.vm_id, vm_scheduled_job.vm_schedule_id, vm_scheduled_job.async_job_id, vm_scheduled_job.action, vm_scheduled_job.scheduled_timestamp) VALUES (x'30333531303530382d616433642d346362342d626632352d633463666538303538653063', 3, 1, NULL, 'START', '2025-09-15 06:02:00') java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '1-2025-09-15 06:02:00' for key 'vm_scheduled_job.vm_schedule_id'
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:555)
        at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:339)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1061)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1009)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1320)
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:994)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
        at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1625)
        at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
        at jdk.proxy3/jdk.proxy3.$Proxy374.persist(Unknown Source)
        at org.apache.cloudstack.vm.schedule.VMSchedulerImpl.scheduleNextJob(VMSchedulerImpl.java:173)
        at org.apache.cloudstack.vm.schedule.VMSchedulerImpl.scheduleNextJobs(VMSchedulerImpl.java:259)
        at org.apache.cloudstack.vm.schedule.VMSchedulerImpl.poll(VMSchedulerImpl.java:227)
        at org.apache.cloudstack.vm.schedule.VMSchedulerImpl$1.runInContext(VMSchedulerImpl.java:205)
        at org.apache.cloudstack.managed.context.ManagedContextTimerTask$1.runInContext(ManagedContextTimerTask.java:30)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
        at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
        at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
        at org.apache.cloudstack.managed.context.ManagedContextTimerTask.run(ManagedContextTimerTask.java:32)
        at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
        at java.base/java.util.TimerThread.run(Timer.java:516)

image

@weizhouapache
Copy link
Member Author

thanks @vishesh92 for testing

as discussed offline, it is a minor issue.
it seems to be because the the job is scheduled twice by the same management server . so this PR is incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recurrent insert errors in database on vm schedules

6 participants