NetXMS Support Forum

English Support => General Support => Topic started by: samuelet on March 26, 2025, 09:33:09 AM

Title: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: samuelet on March 26, 2025, 09:33:09 AM
After upgrading from 5.0.8 to 5.1.4 i get continuously error messages about duplicated keys when inserting into interface_vlan_list.
I tried to delete switch interfaces and polling new config, but it does not resolve.
Problem seems affect Juniper switches, but i'm not sure of this, we have a lot of devices and i'm still monitoring the log.
Db upgrade did not throw any error.

2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 1: "28289"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 2: "53"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 3: "543"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 4: "3C8AB0DC5A52"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 5: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 6: "528"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 7: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 8: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 9: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 10: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 11: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 12: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 13: "ge-0/0/15.0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 14: "1"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 15: "1"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 16: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 17: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 18: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 19: "1514"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 20: "100000000"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 21: "178116"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 22: ""
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 23: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 24: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 25: ""
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 26: ""
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 27: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 28: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 29: "0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 30: "ge-0/0/15.0"
2025.03.26 08:19:08.367 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 31: "178127"
2025.03.26 08:19:08.368 *D* [db.query           ] Successful prepared sync query: "INSERT INTO interfaces (node_id,if_type,if_index,mac_addr,required_polls,bridge_port,phy_chassis,phy_module,phy_pic,phy_port,peer_node_id,peer_if_id,description,admin_state,oper_state,dot1x_pae_state,dot1x_backend_state,peer_proto,mtu,speed,parent_iface,iftable_suffix,last_known_oper_state,last_known_admin_state,if_alias,ospf_area,ospf_if_type,ospf_if_state,stp_port_state,if_name,id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT (id) DO UPDATE SET node_id=excluded.node_id,if_type=excluded.if_type,if_index=excluded.if_index,mac_addr=excluded.mac_addr,required_polls=excluded.required_polls,bridge_port=excluded.bridge_port,phy_chassis=excluded.phy_chassis,phy_module=excluded.phy_module,phy_pic=excluded.phy_pic,phy_port=excluded.phy_port,peer_node_id=excluded.peer_node_id,peer_if_id=excluded.peer_if_id,description=excluded.description,admin_state=excluded.admin_state,oper_state=excluded.oper_state,dot1x_pae_state=excluded.dot1x_pae_state,dot1x_backend_state=excluded.dot1x_backend_state,peer_proto=excluded.peer_proto,mtu=excluded.mtu,speed=excluded.speed,parent_iface=excluded.parent_iface,iftable_suffix=excluded.iftable_suffix,last_known_oper_state=excluded.last_known_oper_state,last_known_admin_state=excluded.last_known_admin_state,if_alias=excluded.if_alias,ospf_area=excluded.ospf_area,ospf_if_type=excluded.ospf_if_type,ospf_if_state=excluded.ospf_if_state,stp_port_state=excluded.stp_port_state,if_name=excluded.if_name" [1 ms]
2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} Successful prepare: "DELETE FROM interface_vlan_list WHERE iface_id=?"

2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 1: "178127"
2025.03.26 08:19:08.368 *D* [db.query           ] Successful sync query: "INSERT INTO idata_169885 (item_id,idata_timestamp,idata_value,raw_value) VALUES (101772,1742973548,'68','68')"
2025.03.26 08:19:08.368 *D* [db.query           ] Successful prepared sync query: "DELETE FROM interface_vlan_list WHERE iface_id=?"
2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} Successful prepare: "INSERT INTO interface_vlan_list (iface_id,vlan_id) VALUES (?,?)"
2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 1: "178127"
2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 2: "0"
2025.03.26 08:19:08.368 *D* [db.query           ] Successful prepared sync query: "INSERT INTO interface_vlan_list (iface_id,vlan_id) VALUES (?,?)" [1 ms]
2025.03.26 08:19:08.368 *D* [db.query           ] {0x7f4dda4c9440} bind at pos 2: "0"
2025.03.26 08:19:08.369 *D* [db.query           ] Successful sync query: "INSERT INTO idata_169914 (item_id,idata_timestamp,idata_value,raw_value) VALUES (84034,1742973548,'73','73')"
2025.03.26 08:19:08.369 *D* [db.query           ] Failed prepared sync query: "INSERT INTO interface_vlan_list (iface_id,vlan_id) VALUES (?,?)"
2025.03.26 08:19:08.369 *E* [db.drv             ] SQL query failed (Query = "INSERT INTO interface_vlan_list (iface_id,vlan_id) VALUES (?,?)"): 23505 ERROR:  duplicate key value violates unique constraint "interface_vlan_list_pkey"
DETAIL:  Key (iface_id, vlan_id)=(178127, 0) already exists.
2025.03.26 08:19:08.369 *D* [db.query           ] Successful sync query: "INSERT INTO idata_170124 (item_id,idata_timestamp,idata_value,raw_value) VALUES (66589,1742973548,'0','0')"
2025.03.26 08:19:08.369 *D* [db.query           ] Successful sync query: "INSERT INTO idata_170124 (item_id,idata_timestamp,idata_value,raw_value) VALUES (66590,1742973548,'2','2')" [1 ms]
2025.03.26 08:19:08.370 *D* [db.query           ] Successful sync query: "INSERT INTO idata_170124 (item_id,idata_timestamp,idata_value,raw_value) VALUES (66583,1742973548,'36','36')"
2025.03.26 08:19:08.370 *D* [db.query           ] ROLLBACK TRANSACTION successful (level 0)
2025.03.26 08:19:08.370 *D* [db.query           ] BEGIN TRANSACTION successful (level 1)
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: samuelet on April 02, 2025, 09:49:09 AM
Any idea?
I found this old thread:
https://www.netxms.org/forum/general-support/failed-db-query-count/msg29219/

Could be a bug with the Juniper DRIVER?
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: Filipp Sudanov on April 02, 2025, 05:42:55 PM
Hi,

The reasons for this are not clear for now. Can you show screenshots of Interfaces tab and VLANs table from Ports tab (you can PM this to me if needed)
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: Victor Kirhenshtein on April 03, 2025, 05:39:56 PM
Hi,

could you please provide SNMP walk output for 1.3.6.1.4.1.2636.3.40.1.5.1.5.1 and 1.3.6.1.4.1.2636.3.40.1.5.1.7.1 for this switch?

Best regards,
Victor
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: samuelet on April 08, 2025, 10:38:48 PM

PM sent
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: samuelet on July 15, 2025, 12:31:09 PM
Problem persists also in version 5.2.4 . Any update about the issue?
Title: Re: duplicate key value violates unique constraint "interface_vlan_list_pkey"
Post by: Filipp Sudanov on July 18, 2025, 04:14:27 PM
Still not resolved, created bugtracker ticket so it won't be forgotten
https://track.radensolutions.com/issue/NX-2813