Unable to execute queries due to atomic block

Condition

You may see the following error after submitting a query from Hue, while logging into Hue, or while saving documents and workflows: "TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block."

Cause

If there is a load on Hue's backend database and slower processing of operations such as saving documents or workflows, running INSERT or UPDATE queries from multiple users, then the database puts an atomic block on the table rows. If you are using MySQL or MariaDB as the backend database for Hue, then you can increase the value of the innodb-lock-wait-timeout parameter along with a few other timeout parameters in the my.cnf file.

Solution

  1. SSH into the database host as an Administrator.
  2. Back up the my.cnf configuration file as follows:
    cp /etc/my.cnf  /[***BACKUP-DIRECTORY***]
  3. Open the my.cnf file for editing and add the following two lines under the [mysqld] section:
    vi /etc/my.cnf
    [mysqld]
    wait_timeout = 28800
    interactive_timeout = 28800
  4. Save the file and exit from the editor.
  5. Restart the database server.