OCSInventory-Server icon indicating copy to clipboard operation
OCSInventory-Server copied to clipboard

Recieving DBD::mysql::db do failed: Duplicate entry errors

Open TheFiZi opened this issue 3 years ago • 11 comments

General informations

Operating system : CentOS Linux release 7.9.2009 (Core)

Server informations

Perl version : v5.16.3 Mysql / Mariadb / Percona version : 5.5.68-MariaDB

OCS Inventory informations

Ocs server version : 2.9.1

Problem's description

Cannot comment on when this started since we only started logging database errors since upgrading to 2.9.1.

I am getting random entries like this popping up:

DBD::mysql::db do failed: Duplicate entry '312427' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '14999' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '312427' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '14999' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '312427' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '14999' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '14999' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '312427' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '313013' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '69972' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.
DBD::mysql::db do failed: Duplicate entry '14999' for key 'PRIMARY' at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 246.

TheFiZi avatar Jul 30 '21 20:07 TheFiZi

Hi @TheFiZi,

Can I ask how did you perform the update to the 2.9.1 version ?

Regards, Léa

Lea9250 avatar Oct 25 '21 08:10 Lea9250

@Lea9250 This problem was something I found in the logs when checking out our system after a 2.9.1 upgrade.

To perform the upgrade I just followed the documentation provided by OCS: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server/

TheFiZi avatar Oct 25 '21 16:10 TheFiZi

Hi @TheFiZi, What does you activity.log say ? Is there any line referencing a lock situation ?

Thanks, Léa

Lea9250 avatar Nov 08 '21 13:11 Lea9250

The activity.log on that day has 42 entries that look like this:

Fri Jul 30 16:24:59 2021;6322;516;210-340-2046-2018-10-24-22-37-34;10.1.80.20;OCS-NG_WINDOWS_AGENT_v2.3.1.1;inventory;device_locked

Some are repeats for the same device.

TheFiZi avatar Nov 08 '21 18:11 TheFiZi

Would it be possible to see the other log entries too ?

Thanks, Léa

Lea9250 avatar Nov 10 '21 10:11 Lea9250

@Lea9250 How far back do you want? The log goes back over a year I think.

TheFiZi avatar Nov 11 '21 00:11 TheFiZi

Hi @TheFiZi,

Maybe get a day where the issue did happen if possible, so I can check if everything seems right on the logs side. I'm trying to understand why would so much of these entries suddenly show up.

Thanks, Léa

Lea9250 avatar Nov 12 '21 08:11 Lea9250

@Lea9250 Sorry for the delay. Here is the log for the entire day.

activity.log

TheFiZi avatar Nov 23 '21 23:11 TheFiZi

Hi, same here :(

DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry '8285' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry '1707' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry '1942' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66.

Update:

have tryed to update to 2.9.2 and same error, disabled all plugins and same errors...

thanks!

jjmg84 avatar Dec 14 '21 12:12 jjmg84

hello, the same here

DBD::mysql::db do failed: Duplicate entry '331' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '323' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '143' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '144' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '263' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '89' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '140' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '234' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '155' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '134' for key 'PRIMARY' at /usr/local/share/perl/5.28.1/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66.

Serverversion is the git version.

ScriptHash avatar Mar 08 '22 08:03 ScriptHash

Hi, 2.10 and same errors :(

DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry '54531' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '23861' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update.pm line 102. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133. DBD::mysql::db do failed: Duplicate entry '73361' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. DBD::mysql::db do failed: Duplicate entry '72936' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/System.pm line 246. DBD::mysql::db do failed: Duplicate entry '39327' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/System.pm line 246. DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update.pm line 102. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59. DBD::mysql::db do failed: Duplicate entry '70196' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/System.pm line 246. DBD::mysql::db do failed: Duplicate entry 'INVENTORY_CACHE_REVALIDATE-ALL' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Cache.pm line 133.

jjmg84 avatar Sep 13 '22 14:09 jjmg84

Hi,

Can you run the following queries for all problematic tables and return the result to me :

  • DESCRIBE my_table;
  • SELECT TABLE STATUS FROM 'my_database' WHERE name LIKE 'my_table';
  • SELECT count(*) FROM my_table;

Best regards, Charlene

charleneauger avatar Oct 11 '22 15:10 charleneauger

Hi,

Since there was no answer, I'll close this issue now

Regards, Charlene

charleneauger avatar Feb 03 '23 14:02 charleneauger