Title: Apache CloudStack Usage Server repeatedly reprocesses historical usage from fixed start date and creates duplicate cloud_usage records · Issue #13112 · apache/cloudstack · GitHub
Open Graph Title: Apache CloudStack Usage Server repeatedly reprocesses historical usage from fixed start date and creates duplicate cloud_usage records · Issue #13112 · apache/cloudstack
X Title: Apache CloudStack Usage Server repeatedly reprocesses historical usage from fixed start date and creates duplicate cloud_usage records · Issue #13112 · apache/cloudstack
Description: problem We identified a persistent duplication issue in the Apache CloudStack Usage Server related to usage_type=13 (Network Offering usage). The Usage Server continuously reprocesses historical usage records starting from 2026-01-13 00:...
Open Graph Description: problem We identified a persistent duplication issue in the Apache CloudStack Usage Server related to usage_type=13 (Network Offering usage). The Usage Server continuously reprocesses historical us...
X Description: problem We identified a persistent duplication issue in the Apache CloudStack Usage Server related to usage_type=13 (Network Offering usage). The Usage Server continuously reprocesses historical us...
Opengraph URL: https://github.com/apache/cloudstack/issues/13112
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Apache CloudStack Usage Server repeatedly reprocesses historical usage from fixed start date and creates duplicate cloud_usage records","articleBody":"### problem\n\nWe identified a persistent duplication issue in the Apache CloudStack Usage Server related to usage_type=13 (Network Offering usage).\n\nThe Usage Server continuously reprocesses historical usage records starting from 2026-01-13 00:00:37, generating duplicate entries in the cloud_usage table every day.\n\nThe issue appears to affect Network Offering usage accounting specifically (usage_type=13).\n\nObserved behavior:\n\nDuplicate cloud_usage rows are inserted repeatedly for the same:\nvm_instance_id\noffering_id\nusage_type\nstart_date\nend_date\nraw_usage\nThe duplicate count increases daily.\nExample:\nrecords for 2026-01-14 currently have 112 duplicates\nrecords for 2026-01-15 currently have 111 duplicates\nrecords for 2026-01-16 currently have 110 duplicates\n\nThe pattern strongly suggests that the Usage Server is reprocessing the entire historical usage window every day instead of advancing the aggregation checkpoint.\n\nExample duplicate query:\n\nSELECT\n vm_instance_id,\n offering_id,\n usage_type,\n start_date,\n end_date,\n raw_usage,\n COUNT(*) AS duplicates\nFROM cloud_usage\nWHERE usage_type = 13\nGROUP BY\n vm_instance_id,\n offering_id,\n usage_type,\n start_date,\n end_date,\n raw_usage\nHAVING COUNT(*) \u003e 1\nORDER BY duplicates DESC;\n\nExample result:\n\nvm_instance_id = 456\noffering_id = 39\nusage_type = 13\nstart_date = 2026-01-14 00:00:00\nend_date = 2026-01-14 23:59:59\nraw_usage = 24\nduplicates = 112\n\nWe also observed repeated failed usage_job entries with invalid processing windows:\n\nstart_date = 2026-05-06 00:00:00\nend_date = 2026-05-05 23:59:59\nsuccess = 0\n\nAt the same time, successful jobs continuously reprocess the same historical range:\n\nstart_date = 2026-01-13 00:00:37\nend_date = 2026-05-05 23:59:59\n\nThis causes:\n\ncontinuous duplicate billing records\ninflated usage data\nincorrect accounting\ncorrupted billing exports/reports\n\n### versions\n\nApache CloudStack Version:\nApache CloudStack 4.21.0.0\nDatabase: 10.6.22-MariaDB-0\nServer: ubuntu0.22.04.1-log Ubuntu 22.04\n\n### The steps to reproduce the bug\n\n1. Enable Usage Server in Apache CloudStack.\n2. Allow the Usage aggregation jobs to run normally for several days/weeks.\n3. Observe the usage_job table.\n4. Observe that successful jobs repeatedly start from the same historical date instead of advancing incrementally.\n5. Observe duplicate rows being inserted repeatedly into cloud_usage.\n6. Run:\nSELECT\n vm_instance_id,\n offering_id,\n usage_type,\n start_date,\n end_date,\n raw_usage,\n COUNT(*) AS duplicates\nFROM cloud_usage\nWHERE usage_type = 13\nGROUP BY\n vm_instance_id,\n offering_id,\n usage_type,\n start_date,\n end_date,\n raw_usage\nHAVING COUNT(*) \u003e 1;\nObserve that duplicate counts increase daily.\n\n### What to do about it?\n\nPotential areas to investigate:\n\nUsage Server aggregation checkpoint handling\nUsage job state persistence\nReprocessing logic for historical aggregation windows\nNetwork Offering usage aggregation (usage_type=13)\nFailed usage_job recovery logic\nValidation for invalid aggregation windows where:\nstart_date \u003e end_date\nDeduplication protections before inserting into cloud_usage","author":{"url":"https://github.com/DaniloMurbach","@type":"Person","name":"DaniloMurbach"},"datePublished":"2026-05-06T23:20:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/13112/cloudstack/issues/13112"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:23411c04-9323-f357-a0b6-791cc797f815 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B29A:2279D0:5A2879:7BF73F:6A4DCCAA |
| html-safe-nonce | 16a11eeacef73f2852763f1038dae16fd66e1cafb7faed2ea5a8449f8907ca5a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjlBOjIyNzlEMDo1QTI4Nzk6N0JGNzNGOjZBNERDQ0FBIiwidmlzaXRvcl9pZCI6IjYzMDQ0NTExMTI1MzIyOTg5MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 82a29ce6cf25f73f4b70fb29442e6dda6f230b4bfadea5bfff98e11aa7fa6f2b |
| hovercard-subject-tag | issue:4395058975 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/cloudstack/13112/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6dd6544794e9c51d008f00590e1948407117ebf2b98c4bdd01d37c17d051e04a/apache/cloudstack/issues/13112 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6dd6544794e9c51d008f00590e1948407117ebf2b98c4bdd01d37c17d051e04a/apache/cloudstack/issues/13112 |
| og:image:alt | problem We identified a persistent duplication issue in the Apache CloudStack Usage Server related to usage_type=13 (Network Offering usage). The Usage Server continuously reprocesses historical us... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DaniloMurbach |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/cloudstack git https://github.com/apache/cloudstack.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 9759448 |
| octolytics-dimension-repository_nwo | apache/cloudstack |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 9759448 |
| octolytics-dimension-repository_network_root_nwo | apache/cloudstack |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width