Deadlock in "metadata_cache" table cause the system having no response

Symptoms:
When the deadlock happened, user could not do any operation as they got no response from system.
This issue also happened last year and it seems that it could be happened repeatedly. As the "metadata_cache" table being deadlock 3 times within 2 years and happened different time of day, it seems like random occurrence.

Investigation:
After we looking at the activity monitor in SQL Server Management Studio, we found that there were quite a few processes with "DELETE FROM metadata_cache WHERE id = 'xxxx-xxx-xx-xxx' " having deadlock. We also found that there are 3 records in metadata_cache table with the same type "meta_hash_base".

Action after encountering the issue:
The server being rebooted, the metadata_cache table was truncated and then asked user to login to the system. The records in metadata_cache table were then rebuilt and the system resumed.

Issue simulation:
I tried to create multiple "meta_hash_base" records in metadata_cache table. After I login to the system using a new browser instance, the system is then no response and the metadata_cache table being deadlock.

I would like to ask few questions regarding the metadata_cache table:

1. What is the role of metadata cache table? (There is an article on SugarCRM developer guide but it seems focus on the file and architecture on application server)
2. The operation that involved lookup on metadata cache table. (e.g. View the record in some modules)
3. How often will the entries in metadata cache table be updated / deleted / inserted?
4. Could we set the field "Type" as the key so that meta_hash_base entry will not be duplicated?

Thank you.

Environment: SugarCRM Pro 7.6.2.1, MS SQL Server 2014, PHP 5.4.45

Parents Reply Children
  • I guess that means they did not fix all of the metadata_cache issues in 7.7.2.1.  Have you upgraded past 7.9.4?  Did the issue continue?

    I've only ever seen this issue on the one Windows/MSSQL instance I inherited.  I've never had this issue on LAMP.

  • Hi Justin,

    Thank you for your reply.

    When I take a look at the release note of version 7.7.2.1,

    it stated that:

    "Known Issue 74919 : Performing certain actions (e.g. Quick Repair and Rebuild) in Sugar that rebuild the cache files may cause unexpected issues in the system if there are multiple users logged in and utilizing Sugar."

    However, they did not mention any changes related to cache in 7.7.2.1.

    May I ask the server condition when you tackle the deadlock issue? I found that the DB server having high memory usage (Used to occupied all the system memory, then the system having very slow / no response) and limited the DB Server to occupied up to 8x% of system memory. I'm not sure if this issue is triggered by high memory usage and multiple user logged in and using the function in Sugar.

    Update the version would be definitely an option to solve / alleviate the problem and we would schedule to update to current supported version.

    Thanks.

    Kent