Mautic crashed: internal server error after editing dashboard "Best email read hours" widget

Your software
My Mautic version is: 4.0.2
My PHP version is: 7.4.3
My Database type and version is:
DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
mysql Ver 15.1 Distrib 10.3.31-MariaDB, for debian-linux-gnu (aarch64) using readline 5.2

Your problem
My problem is:
Mautic has crashed after editing a simple “Best email read hours” widget.
Even clearing cache doesn’t bring it to life.

These errors are showing in the log:

[2021-11-24 11:58:51] mautic.ERROR: Invalid clickthrough value: Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo0NzoiZGJ6Y2J2dGEuZmlmYWciO3Y6NDt2Ojc2MTt9Zjo4OiJmemJ2eSI7djo4MTtmOjc6ImZnYmciO2Y6NTU6Ijk0MmVlMjhkOWNiOWQ2MjU5NzMzMzgiO2Y6NzoieWZiZSI7Zjo3OiI5NDc2IjtmOjA6ImR1YmFhZnkiO2I6NDp7Zjo4OiJmemJ2eSI7djo4MTt9fQ== {"exception":"[object] (Mautic\\CoreBundle\\Exception\\InvalidDecodedStringException(code: 0): The string b:8:{f:9:\"fbhedf\";b:5:{v:3;f:47:\"dbzcbvta.fifag\";v:4;v:761;}f:8:\"fzbvy\";v:81;f:7:\"fgbg\";f:55:\"942ee28d9cb9d625973338\";f:7:\"yfbe\";f:7:\"9476\";f:0:\"dubaafy\";b:4:{f:8:\"fzbvy\";v:81;}} is not a serialized array at /var/www/mautic/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"} []
[2021-11-24 11:58:51] mautic.ERROR: Invalid clickthrough value: Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo0NzoiZGJ6Y2J2dGEuZmlmYWciO3Y6NDt2Ojc2MTt9Zjo4OiJmemJ2eSI7djo4MTtmOjc6ImZnYmciO2Y6NTU6Ijk0MmVlMjhkOWNiOWQ2MjU5NzMzMzgiO2Y6NzoieWZiZSI7Zjo3OiI5NDc2IjtmOjA6ImR1YmFhZnkiO2I6NDp7Zjo4OiJmemJ2eSI7djo4MTt9fQ== {"exception":"[object] (Mautic\\CoreBundle\\Exception\\InvalidDecodedStringException(code: 0): The string b:8:{f:9:\"fbhedf\";b:5:{v:3;f:47:\"dbzcbvta.fifag\";v:4;v:761;}f:8:\"fzbvy\";v:81;f:7:\"fgbg\";f:55:\"942ee28d9cb9d625973338\";f:7:\"yfbe\";f:7:\"9476\";f:0:\"dubaafy\";b:4:{f:8:\"fzbvy\";v:81;}} is not a serialized array at /var/www/mautic/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"} []
[2021-11-24 22:11:24] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getCount() on int" at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php line 187 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getCount() on int at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php:187)"} []
[2021-11-24 22:22:37] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:22:49] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:24:55] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:01] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:05] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:25:16] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []
[2021-11-24 22:27:05] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpWAmy7Y" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpWAmy7Y\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:05] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpNqWgTW" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:12] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpkdr5Rq" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpkdr5Rq\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:12] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpNTcWls" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:15] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpO00xvV" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpO00xvV\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:15] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpWKVziT" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:18] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpAVqQ9E" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpAVqQ9E\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:18] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpZyfd2D" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:27:20] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.phpNdaFqe" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.phpNdaFqe\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:27:20] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpYa2kzh" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []
[2021-11-24 22:28:01] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Cannot rename "/tmp/UrlMatcher.php93cHEe" to "/var/www/mautic/var/cache/prod/UrlMatcher.php"." at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {"exception":"[object] (Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Cannot rename \"/tmp/UrlMatcher.php93cHEe\" to \"/var/www/mautic/var/cache/prod/UrlMatcher.php\". at /var/www/mautic/vendor/symfony/filesystem/Filesystem.php:290)"} []
[2021-11-24 22:28:01] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename "/tmp/UrlGenerator.phpo1p2If" to "/var/www/mautic/var/cache/prod/UrlGenerator.php". - in file /var/www/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 [] []

Steps I have tried to fix the problem:
Cleared mautic cache

Relevant bug report: Mautic crashed: internal server error after editing dashboard “Best email read hours” widget · Issue #10640 · mautic/mautic (github.com)

Update: fixed cache permission issues. But still getting 500 internal server error.

I think the problem is here:

[2021-11-24 22:11:24] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getCount() on int" at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php line 187 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getCount() on int at /var/www/mautic/app/bundles/StatsBundle/Aggregate/Calculator.php:187)"} []

or here:

[2021-11-24 22:22:37] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function createQueryBuilder() on null" at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php line 79 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function createQueryBuilder() on null at /var/www/mautic/app/bundles/EmailBundle/Stats/Helper/FilterTrait.php:79)"} []

How do I get mautic working again?

update: just checked, all other mautic urls working perfectly, except for dashboard.

Maybe if I disabled “Best email read hours” widget from the dashboard, I could get Mautic working again, but I don’t know how to disable that widget.

UPDATE: FIXED

Ran following commands on my machine:

1 .Fist login as root user in your mysql.

sudo mysql -u root
  1. Replace mautic-database-name with your own mautic database name and run this in mysql interface:
USE mautic-database-name;
  1. Print widgets table:
SELECT * FROM widgets;
  1. find out the ID of the widget that is broken and update its params, in my case the ID of the widget was 7, so:
UPDATE widgets SET params = "a:0:{}" WHERE id = 7;

that’s it!

cheers!

1 Like

Having the same problem with 4.1.0 (can’t update to 4.2 for some reason), created a similar widget that prevents the Dashboard from showing. Same error message. Tried this solution, but it didn’t work. I then deleted the DB entry for the widget entirely, without luck. Thoughts?

Seems this is still an issue in 4.2.1 as well, I ran into it yesterday.

1 Like

Did shailemalla’s solution work for you?

I also still have this issue with 4.4. I guess it can be fixed with the workaround. However, the system should not crash and logout the user like this. We have to find a solution where this error does not happen. I will take a look into it for a bit.

I just updated to the latest code from the 4.4 branch. This solved my problem. The Widget Best Email Sending Time is displayed on my dashboard.

I’m also seeing this issue on several M4.x installs.

Thank you @shailemalla for the fix.
This is a great workaround, but I think the problem should be properly identified and corrected.

I suspect the issue is one or more complex queries which do not return anything until the script times out.
Hence, it might seem it is working but it is just taking longer than usual (up to whatever timeout time you have set on your php.ini), but what is going on is that the query is not being fulfilled in time or at all and the results are taken from cache, once you hit your timeout.

I also suspect there might be 2 different issues showing similar symptoms, one would be the long-running complex query issues, which are usually complex time-related-queries, which return an sql-orm-doctrine related error.
And a different problem, causing the Apache (500-type if I remember correctly) or Mautic blocking error rendering the UI inaccessible.

In my case I am (mostly) using Mautic 4.4.5 on top of Ubuntu 20.04 with MySQL 8.0 and PHP 8.0, so it looks like this affects all sorts of infrastructure indiscriminately, which would point to a bug in the code.