Code Monkey home page Code Monkey logo

Comments (8)

laszlokertesz avatar laszlokertesz commented on September 24, 2024

I found the log entries. It does seem to point to the glpi inventory plugin?

/var/www/html/glpi/files/_log/sql-errors.log:  SQL: DELETE `glpi_logs` FROM `glpi_logs` WHERE `itemtype` = 'Agent' AND `items_id` = '1051'
/var/www/html/glpi/files/_log/sql-errors.log-  Error: Lock wait timeout exceeded; try restarting transaction
/var/www/html/glpi/files/_log/sql-errors.log-  Backtrace :
/var/www/html/glpi/files/_log/sql-errors.log-  src/DBmysql.php:1579                               
/var/www/html/glpi/files/_log/sql-errors.log-  src/CommonDBTM.php:841                             DBmysql->delete()
/var/www/html/glpi/files/_log/sql-errors.log-  src/CommonDBTM.php:787                             CommonDBTM->cleanHistory()
/var/www/html/glpi/files/_log/sql-errors.log-  src/CommonDBTM.php:2068                            CommonDBTM->deleteFromDB()
/var/www/html/glpi/files/_log/sql-errors.log-  src/CommonDBTM.php:4627                            CommonDBTM->delete()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Asset/MainAsset.php:786              CommonDBTM->deleteByCriteria()
/var/www/html/glpi/files/_log/sql-errors.log-  src/RuleImportAsset.php:969                        Glpi\Inventory\Asset\MainAsset->rulepassed()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Rule.php:1525                                  RuleImportAsset->executeActions()
/var/www/html/glpi/files/_log/sql-errors.log-  src/RuleCollection.php:1640                        Rule->process()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Asset/MainAsset.php:573              RuleCollection->processAllRules()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Inventory.php:709                    Glpi\Inventory\Asset\MainAsset->handle()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Inventory.php:340                    Glpi\Inventory\Inventory->handleItem()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Request.php:360                      Glpi\Inventory\Inventory->doInventory()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Inventory/Request.php:90                       Glpi\Inventory\Request->inventory()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Agent/Communication/AbstractRequest.php:359    Glpi\Inventory\Request->handleAction()
/var/www/html/glpi/files/_log/sql-errors.log-  src/Agent/Communication/AbstractRequest.php:271    Glpi\Agent\Communication\AbstractRequest->handleJSONRequest()
/var/www/html/glpi/files/_log/sql-errors.log-  front/inventory.php:92                             Glpi\Agent\Communication\AbstractRequest->handleRequest()
/var/www/html/glpi/files/_log/sql-errors.log-  plugins/glpiinventory/front/communication.php:72   include_once()
/var/www/html/glpi/files/_log/sql-errors.log-  plugins/glpiinventory/index.php:45                 include_once()
/var/www/html/glpi/files/_log/sql-errors.log-  {"user":"[email protected]","mem_usage":"87.900\", 6.13Mio)"} 

from glpi.

laszlokertesz avatar laszlokertesz commented on September 24, 2024

I traced it to
src/Inventory/Asset/MainAsset.php, part of Glpi proper.

Line 834

        //check for any old agent to remove
         $agent = new \Agent();
         $agent->deleteByCriteria([
             'itemtype' => $this->item->getType(),
             'items_id' => $items_id,
             'NOT' => [
                 'id' => $this->agent->fields['id']
             ]
         ]);

If i comment these lines out, everything returns to normal. Is this section really necessary?

from glpi.

stonebuzz avatar stonebuzz commented on September 24, 2024

This code deletes the agent from the asset currently being inventoried if it has changed (for example, you switch from Fusion to GLPI-agent).

This will lead to a cascade of database cleanup, particularly in the glpi_logs table, where all entries relating to this itemtype and item_id must be deleted.

What does the following SQL query return?

SELECT count(*) FROM `glpi_logs` WHERE `itemtype` = 'Agent' AND `items_id` = '1051'

Best regards

from glpi.

laszlokertesz avatar laszlokertesz commented on September 24, 2024

This code deletes the agent from the asset currently being inventoried if it has changed (for example, you switch from Fusion to GLPI-agent).

This will lead to a cascade of database cleanup, particularly in the glpi_logs table, where all entries relating to this itemtype and item_id must be deleted.

What does the following SQL query return?

SELECT count(*) FROM `glpi_logs` WHERE `itemtype` = 'Agent' AND `items_id` = '1051'

Best regards

About 50 000 000 lines. Obviously this is our issue here.
Actualy the issue is that this is trigered for hundreds of agents in a few minutes. I let them run in the weekend but none finished even after 12 hours and the server was mostly unresponsive for Web UI management, the logs were full of timed ot transactions.

And we switched to glpi agent a while ago. But only after we rebooted the server this was triggered for some reason.

from glpi.

cconard96 avatar cconard96 commented on September 24, 2024

Are all your tables migrated to using InnoDB instead of MyISAM? There are a lot of performance benefits including smarter locking. With MyISAM, the entire table is locked (made read-only) during a DELETE operation.

from glpi.

laszlokertesz avatar laszlokertesz commented on September 24, 2024

Are all your tables migrated to using InnoDB instead of MyISAM? There are a lot of performance benefits including smarter locking. With MyISAM, the entire table is locked (made read-only) during a DELETE operation.

I think so. The logs table definitely is.

from glpi.

stonebuzz avatar stonebuzz commented on September 24, 2024

@laszlokertesz

Can you view the agent's history with the ID 1051

image

Do you see anything unusual (an untimely change of linked item, something else)?

from glpi.

github-actions avatar github-actions commented on September 24, 2024

There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days.

If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue.
If it is related to a new feature, please open a topic to discuss with community about this enhancement on suggestion website.

You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.

from glpi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.