Bug #17401
closedError logs about duplicated entries to nodeComplianceLevel after policy generation.
Description
Since we empty compliance cache during policy generation, after policy generation, we rebuild almost immediatly a new compliance cache with the same value as we had before and thus we insert compliance we have already inserted.
However, it has no impact on Rudder, compliance is ok and nothing else is happening.
[2020-05-14 11:02:27+0200] INFO policy.generation - Successful policy update '10' [started 2020-05-14 11:02:26 - ended 2020-05-14 11:02:27] [2020-05-14 11:02:27+0200] INFO policy.generation - Start policy generation, checking updated rules [2020-05-14 11:02:27+0200] ERROR report - Error when saving node compliances: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsd isabled,compliant,auditnotap... [2020-05-14 11:02:27+0200] ERROR report.cache - Error when updating compliance cache for nodes: [65e2eb84-5bc5-4edb-a479-fd618b0a3de4]: SystemError: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( '65e2eb84-5bc5-4edb-a479-fd618b0a3de4','2020-05-14 10:58:20+02','inventory-all','inventory-all',0,1,0,0,0,0,0,0,0,0,0,0,0,0 ) was aborted: ERROR: duplicate key value violates unique constraint "nodecompliancelevels_pkey" Detail: Key (nodeid, runtimestamp, ruleid, directiveid)=(65e2eb84-5bc5-4edb-a479-fd618b0a3de4, 2020-05-14 10:58:20+02, inventory-all, inventory-all) already exists. Call getNextException to see other errors in the batch.; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( '65e2eb84-5bc5-4edb-a479-fd618b0a3de4','2020-05-14 10:58:20+02','inventory-all','inventory-all',0,1,0,0,0,0,0,0,0,0,0,0,0,0 ) was aborted: ERROR: duplicate key value violates unique constraint "nodecompliancelevels_pkey" Detail: Key (nodeid, runtimestamp, ruleid, directiveid)=(65e2eb84-5bc5-4edb-a479-fd618b0a3de4, 2020-05-14 10:58:20+02, inventory-all, inventory-all) already exists. Call getNextException to see other errors in the batch. -> [2020-05-14 11:02:27+0200] INFO policy.generation - [metrics] Xmx:1015 MB nodes:3 (cached:3) rules:5 (enabled:5) techniques:44 (enabled:44) directives:6 (enabled:6) groups:6 (dynamic:6) parameters:1 [2020-05-14 11:02:27+0200] INFO policy.generation - No node configuration was updated, no policies to write
Updated by Vincent MEMBRÉ over 4 years ago
- Subject changed from parent ticket didn't fix the issue to Error logs about duplicated entries to nodeComplianceLevel after policy generation.
- Description updated (diff)
- Parent task deleted (
#17373) - Severity set to Trivial - no functional impact | cosmetic
- User visibility set to Operational - other Techniques | Rudder settings | Plugins
- Priority changed from 0 to 29
Updated by François ARMAND over 4 years ago
- Related to Bug #17373: duplicates entries when saving node compliance levels added
Updated by François ARMAND over 4 years ago
This still happens in Rudder 6.1.0~rc3:
0-06-09 07:48:22+0000] INFO policy.generation - Successful policy update '9' [started 2020-06-09 07:48:20 - ended 2020-06-09 07:48:22] [2020-06-09 07:48:22+0000] ERROR report - Error when saving node compliances: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotap... [2020-06-09 07:48:22+0000] ERROR report.cache - Error when updating compliance cache for nodes: [root, 959531df-4401-4092-8202-b8d1d5276157]: SystemError: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( 'root','2020-06-09 07:45:16+00','server-roles','server-roles-directive',0,24,0,0,0,0,0,1,0,0,0,0,0,0 ) was aborted: ERROR: duplicate key value violates unique constraint "nodecompliancelevels_pkey" Detail: Key (nodeid, runtimestamp, ruleid, directiveid)=(root, 2020-06-09 07:45:16+00, server-roles, server-roles-directive) already exists. Call getNextException to see other errors in the batch.; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( 'root','2020-06-09 07:45:16+00','server-roles','server-roles-directive',0,24,0,0,0,0,0,1,0,0,0,0,0,0 ) was aborted: ERROR: duplicate key value violates unique constraint "nodecompliancelevels_pkey" Detail: Key (nodeid, runtimestamp, ruleid, directiveid)=(root, 2020-06-09 07:45:16+00, server-roles, server-roles-directive) already exists. Call getNextException to see other errors in the batch. ->
Updated by François ARMAND over 4 years ago
- Status changed from New to Resolved
- Target version changed from 6.0.7 to 6.1.0~rc4
Corrected by #17373
Updated by François ARMAND over 4 years ago
- Fix check changed from To do to Checked
Updated by Nicolas CHARLES over 4 years ago
- Fix check changed from Checked to Error - Blocking
it still happens in 6.1.rc4, after policy generation
[2020-06-12 11:41:51+0200] ERROR report - SystemError: Error when saving node compliances:; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directi veid,pending,success,r... [2020-06-12 11:41:51+0200] ERROR application - Error when executing [Store Agent Run Times] scheduler task started at 2020-06-12T11:41:51+02:00, ended at 2020-06-12T11:41:51+02:00. <- SystemError: Error when saving node compliances:; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( '54979986-7bca-40eb-8517-2e7c17c8b195','2020-06-12 11:35:56+02','inventory-all','inventory-all',0,1,0,0,0,0,0,0,0,0,0,0,0,0 ) was aborted: ERROR: duplicate key value violates unique constraint "nodecompliancelevels_pkey" Detail: Key (nodeid, runtimestamp, ruleid, directiveid)=(54979986-7bca-40eb-8517-2e7c17c8b195, 2020-06-12 11:35:56+02, inventory-all, inventory-all) already exists. Call getNextException to see other errors in the batch. ->
maybe worth stating that it was right after a failed policy generation
Updated by Nicolas Ecarnot over 4 years ago
- Priority changed from 29 to 28
Hello,
I still see it in 6.1.3 :
Aug 24 15:22:46 sit-conf-prd01 rudder[report]: [ERROR] SystemError: Error when saving node compliances:; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pe nding,success,r... Aug 24 15:22:46 sit-conf-prd01 rudder[application]: [ERROR] Error when executing [Store Agent Run Times] scheduler task started at 2020-08-24T15:22:46+02:00, ended at 2020-08-24T15:22:46+02:00. <- SystemError: Error when saving node comp liances:; cause was: java.sql.BatchUpdateException: Batch entry 0 insert into nodecompliancelevels (nodeid,runtimestamp,ruleid,directiveid,pending,success,repaired,error,unexpected,missing,noanswer,notapplicable,reportsdisabled,compliant ,auditnotapplicable,noncompliant,auditerror,badpolicymode) values ( '47e5f885-9d8f-46b2-b70a-fd494f27163b','2020-08-24 15:18:16+02','2f853188-6324-4826-ac98-1dab91aa05cb','ea300f6f-6a72-4e20-94d9-dd46e198d8f7',0,1,0,0,0,0,0,1,0,0,0,0,0,0 ) was aborted: ERREUR: la valeur d'une clé dupliquée romp t la contrainte unique « nodecompliancelevels_pkey » Detail: La clé « (nodeid, runtimestamp, ruleid, directiveid)=(47e5f885-9d8f-46b2-b70a-fd494f27163b, 2020-08-24 15:18:16+02, 2f853188-6324-4826-ac98-1dab91aa05cb, ea300f6f-6a72-4e20-94d9-dd46e198d8f7) » existe déjà. Call getNextExcepti on to see other errors in the batch. ->
Updated by François ARMAND over 4 years ago
Did you noticed when it happened (or does the log give you clues on that?). It used to be just after a policy generation, is it still the case?
Updated by Nicolas Ecarnot over 4 years ago
François ARMAND wrote in #note-8:
Did you noticed when it happened (or does the log give you clues on that?). It used to be just after a policy generation, is it still the case?
According to what I read, it does not seem related to policy generation, but happens anytime.
Yet, it also happens after policy regen.