OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

Ocs Inventory Server 2.9.2 issue #384

Closed naccey closed 1 year ago

naccey commented 2 years ago

It's hard to solve a problem when important details are missing, that why we added this template, to help you and us.

General informations

Operating system : Ubuntu 20.04.4 LTS

Server informations

Perl version : perl 5, version 30 Mysql / Mariadb / Percona version :
MySQL Community Server - GPL version 8.0.20

OCS Inventory informations

Ocs server version : 2.9.2

Problem's description

Describe your problem here Hello All, I have few problems below and attacheded screenshot How to solve theese problems? Thanks for yours support sincerly ;)

mysql error DBD::mysql::db do failed: Duplicate entry '3071' for key 'accountinfo.PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66.

DBD::mysql::db do failed: The table 'prolog_conntrack' is full at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 46.

DBD::mysql::db do failed: Duplicate entry 'SESSION-CLEAN' for key 'engine_mutex.PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59.

DBD::mysql::st execute failed: Deadlock found when trying to get lock; try restarting transaction at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Software.pm line 59. mysql_failed

Asimatasert commented 2 years ago

Hello , For This Dublicate Solition

mysql error DBD::mysql::db do failed: Duplicate entry '3071' for key 'accountinfo.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 'SESSION-CLEAN' for key 'engine_mutex.PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Communication/Session.pm line 59.

This problem will solve AccountInfos.pm line 66 and Session.pm line 59 you need to have a check before if statement with a sql query, it's problem weld to insert a same record in to db , ocs devs must have forgotten to make this line

Sample php function for crush the issue

function checkIfExist($e){ $q="SELECT * FROM DBTABLENAME WHERE col=$e" if(!$q){ $q="INSERT into DBTABLENAME col values ($e)" } else{die;} }

jjmg84 commented 1 year ago

Hi, i have the three errors tooo :(

Duplicates & Prolog Full :(

charleneauger commented 1 year ago

Hi @naccey and @jjmg84 ,

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

@naccey : the PR #405 should fix deadlock on software.pm

Best regards, Charlene

jjmg84 commented 1 year ago

Hi, i atach one line of every error:

DBD::mysql::db do failed: Duplicate entry '50581' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/System.pm line 246. Line 246 makes a insert: 'INSERT INTO locks(HARDWARE_ID, ID, SINCE) VALUES(?,?,NOW()) imagen imagen imagen

DBD::mysql::db do failed: Duplicate entry '66109' for key 'PRIMARY' at /usr/local/share/perl/5.30.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm line 66. line 66 makes a insert: 'INSERT INTO accountinfo(HARDWARE_ID) VALUES(?)' imagen imagen imagen

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. Line 59 makes a insert: INSERT INTO engine_mutex(NAME, PID, TAG) VALUES('SESSION',?,'CLEAN') imagen imagen imagen

Here are the data @charleneauger

thanks!

charleneauger commented 1 year ago

Hi @naccey, @Asimatasert, @jjmg84,

After analysis, it turns out that the server executes INSERT queries without verifying the existence of the data. We have added this correction to our Roadmap.

Regards, Charlene