Skip to content

Duplicate event in the usage_event causes it to never get processed #12590

@abh1sar

Description

@abh1sar

problem

It was observed that in the usage_events table, two VM.START events for the same VM had the same timestamp

id type account_id created count resource_id name
1067272 VM.START 653 2025-10-27 13:02:07 2 66880 fedora
1067284 VM.STOP 653 2025-10-27 13:02:06 2 66880 fedora
1067293 VM.START 653 2025-10-27 13:02:07 2 66880 fedora

This leads to exception in createVMHelperEvent and this event is never marked as processed.

java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '66880-1-2025-10-27 13:02:07' for key 'usage_vm_instance.vm_instance_id'
"2025-12-22 00:06:57,536 ERROR [cloud.usage.UsageManagerImpl_EnhancerByCloudStack_ba4e5a30] (Usage-Job-1:[]) (logid:) Error saving usage instance for vm: 66880 javax.persistence.EntityExistsException: Entity already exists"

This causes the usage server to always start processing from this point.

versions

No response

The steps to reproduce the bug

...

What to do about it?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions