ChurchCRM / CRM

ChurchCRM is an OpenSource Church CRM & Management Software.
https://ChurchCRM.io
MIT License
618 stars 434 forks source link

Family view error #5625

Closed ChurchCRMBugReport closed 3 years ago

ChurchCRMBugReport commented 3 years ago

When viewing a Family i get the error

Slim Application Error

It is also showing when saving a family

Collected Value Title Data
Page Name /FamilyEditor.php?FamilyID=1
Screen Size 812x375
Window Size 640x375
Page Size 2076x375
Platform Information Linux s223.webhostingserver.nl 3.10.0-962.3.2.lve1.5.32.el6h.x86_64 #1 SMP Fri Feb 28 08:22:57 EST 2020 x86_64
PHP Version 7.4.11
SQL Version 5.5.5-10.4.17-MariaDB-log-cll-lve
ChurchCRM Version 4.3.1
Reporting Browser Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 EdgiOS/45.11.11 Mobile/15E148 Safari/605.1.15
Prerequisite Status All Prerequisites met
Integrity check status {"status":"success"}
Apache Modules mod_rewrite,mod_mime,mod_headers,mod_expires,mod_auth_basic
MrClever commented 3 years ago

This is often a problem with the saturation of the SQL connection pool (#4522 #5171) which we believe is intermittently triggered by background jobs running when pages load. We're working toward splitting the background jobs out of the UI workflow (see #5231) but that hasn't been implemented yet.

In the meantime, if you check your /path/to/ChurchCRM/logs log files, you can confirm this hypothesis by looking for entries like this:

MySQL Error: 'User **yourDBuser** already has more than 'max_user_connections' active connections' [] {"url":"/api/background/timerjobs"
zuwhan commented 3 years ago

I also see the same error. This is my log:

[09-Jan-2021 22:32:09 America/Los_Angeles] Slim Application Error: Type: Error Message: Call to a member function getValue() on null File: /home/nloc/newlifeoasis.org/churchcrm/ChurchCRM/model/ChurchCRM/User.php Line: 316 Trace: #0 /home/nloc/newlifeoasis.org/churchcrm/v2/templates/people/family-view.php(476): ChurchCRM\User->isShowPledges()

1 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(203): include('/home/nloc/newl...')

2 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(184): Slim\Views\PhpRenderer->protectedIncludeScope('templates/peopl...', Array)

3 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(153): Slim\Views\PhpRenderer->fetchTemplate('family-view.php', Array)

4 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(54): Slim\Views\PhpRenderer->fetch('family-view.php', Array, true)

5 /home/nloc/newlifeoasis.org/churchcrm/v2/routes/family.php(110): Slim\Views\PhpRenderer->render(Object(Slim\Http\Response), 'family-view.php', Array)

6 [internal function]: viewFamily(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

7 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func('viewFamily', Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

8 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke('viewFamily', Object(Slim\Http\Request), Object(Slim\Http\Response), Array)

9 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))

10 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))

11 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/App.php(503): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))

12 /home/nloc/newlifeoasis.org/churchcrm/ChurchCRM/Slim/Middleware/VersionMiddleware.php(13): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))

13 [internal function]: ChurchCRM\Slim\Middleware\VersionMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))

14 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(ChurchCRM\Slim\Middleware\VersionMiddleware), Array)

15 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))

16 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Slim\App))

17 /home/nloc/newlifeoasis.org/churchcrm/ChurchCRM/Slim/Middleware/AuthMiddleware.php(34): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))

18 [internal function]: ChurchCRM\Slim\Middleware\AuthMiddleware->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))

19 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array(Object(ChurchCRM\Slim\Middleware\AuthMiddleware), Array)

20 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))

21 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))

22 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))

23 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))

24 /home/nloc/newlifeoasis.org/churchcrm/vendor/slim/slim/Slim/App.php(297): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))

25 /home/nloc/newlifeoasis.org/churchcrm/v2/index.php(48): Slim\App->run()

26 {main}

shihkuang commented 3 years ago

we have the same error too. There is no saturation of the SQL connection error.

[21-Jan-2021 00:00:45 America/Vancouver] Slim Application Error: Type: Error Message: Call to a member function getValue() on null File: /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/ChurchCRM/model/ChurchCRM/User.php Line: 316 Trace: #0 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/v2/templates/people/family-view.php(476): ChurchCRM\User->isShowPledges()

1 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/php-view/src/PhpRenderer.php(203): include('/home/290143.cl...')

2 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/php-view/src/PhpRenderer.php(184): Slim\Views\PhpRenderer->protectedIncludeScope()

3 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/php-view/src/PhpRenderer.php(153): Slim\Views\PhpRenderer->fetchTemplate()

4 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/php-view/src/PhpRenderer.php(54): Slim\Views\PhpRenderer->fetch()

5 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/v2/routes/family.php(110): Slim\Views\PhpRenderer->render()

6 [internal function]: viewFamily()

7 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()

8 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()

9 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke()

10 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()

11 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()

12 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/ChurchCRM/Slim/Middleware/VersionMiddleware.php(13): Slim\App->__invoke()

13 [internal function]: ChurchCRM\Slim\Middleware\VersionMiddleware->__invoke()

14 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()

15 [internal function]: Slim\DeferredCallable->__invoke()

16 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()

17 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/ChurchCRM/Slim/Middleware/AuthMiddleware.php(34): Slim\App->Slim{closure}()

18 [internal function]: ChurchCRM\Slim\Middleware\AuthMiddleware->__invoke()

19 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()

20 [internal function]: Slim\DeferredCallable->__invoke()

21 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()

22 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}()

23 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()

24 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/vendor/slim/slim/Slim/App.php(297): Slim\App->process()

25 /home/290143.cloudwaysapps.com/fvhrfkuejp/public_html/v2/index.php(48): Slim\App->run()

26 {main}

View in rendered output by enabling the "displayErrorDetails" setting.

webnerdnick commented 3 years ago

Same here, new install on Centos 7.9.2009, with PHP 7.4 A grep of the logs folder for max_user connections doesn't yield anything, neither a grep of any other php or mysql log shows connection issues.

If there are other logs or specific debugging steps you want me to take, let me know.

[02-Feb-2021 16:44:45 America/New_York] Slim Application Error: Type: Error Message: Call to a member function getValue() on null File: /var/www/crm.hopebaptistclearfield.org/html/churchcrm/ChurchCRM/model/ChurchCRM/User.php Line: 316 Trace: #0 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/v2/templates/people/family-view.php(476): ChurchCRM\User->isShowPledges()

1 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(203): include('/var/www/crm.ho...')

2 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(184): Slim\Views\PhpRenderer->protectedIncludeScope()

3 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(153): Slim\Views\PhpRenderer->fetchTemplate()

4 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/php-view/src/PhpRenderer.php(54): Slim\Views\PhpRenderer->fetch()

5 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/v2/routes/family.php(110): Slim\Views\PhpRenderer->render()

6 [internal function]: viewFamily()

7 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(40): call_user_func()

8 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/Route.php(281): Slim\Handlers\Strategies\RequestResponse->__invoke()

9 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke()

10 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/Route.php(268): Slim\Route->callMiddlewareStack()

11 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/App.php(503): Slim\Route->run()

12 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/ChurchCRM/Slim/Middleware/VersionMiddleware.php(13): Slim\App->__invoke()

13 [internal function]: ChurchCRM\Slim\Middleware\VersionMiddleware->__invoke()

14 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()

15 [internal function]: Slim\DeferredCallable->__invoke()

16 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()

17 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/ChurchCRM/Slim/Middleware/AuthMiddleware.php(34): Slim\App->Slim{closure}()

18 [internal function]: ChurchCRM\Slim\Middleware\AuthMiddleware->__invoke()

19 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/DeferredCallable.php(57): call_user_func_array()

20 [internal function]: Slim\DeferredCallable->__invoke()

21 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func()

22 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->Slim{closure}()

23 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/App.php(392): Slim\App->callMiddlewareStack()

24 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/vendor/slim/slim/Slim/App.php(297): Slim\App->process()

25 /var/www/crm.hopebaptistclearfield.org/html/churchcrm/v2/index.php(48): Slim\App->run()

26 {main}

View in rendered output by enabling the "displayErrorDetails" setting.

webnerdnick commented 3 years ago

I actually researched this a little- it was flagging on .churchcrm/ChurchCRM/model/ChurchCRM/User.php line 316, which was: public function isShowPledges() { return $this->getSetting(UserSetting::FINANCE_SHOW_PLEDGES)->getValue() == "true"; }

I went into Admin->Edit General Settings->Enabled Features, and disabled Fiance, and retested, and the error resolved.

shihkuang commented 3 years ago

I actually researched this a little- it was flagging on .churchcrm/ChurchCRM/model/ChurchCRM/User.php line 316, which was: public function isShowPledges() { return $this->getSetting(UserSetting::FINANCE_SHOW_PLEDGES)->getValue() == "true"; }

I went into Admin->Edit General Settings->Enabled Features, and disabled Fiance, and retested, and the error resolved.

Thanks, it works for me too!

MrClever commented 3 years ago

I resolved the same thing on our production system too (but in reverse - was able to recreate the error if I enabled the Finance module). It shouldn't happen even with the Finance module enable though.

@crossan007 / @DawoudIO - I don't have much time to dig into this right now, but wondering if we should add a check for NULL in here somewhere? Trying to untagle the object model is a little beyond my mental capacity right now but something like this in ChurchCRM/model/ChurchCRM/User.php:

public function isShowPledges() {
    $foo = $this->getSetting(UserSetting::FINANCE_SHOW_PLEDGES)->getValue();
    if ($foo is NULL) {
        $foo = FALSE;
    } else {
        $foo = TRUE;
    } 
    return $foo
}

(might need to adapt this, but the logic would need to be placed in other places where unexpected NULLs could cause problems)

DawoudIO commented 3 years ago

Looks like this was a bug due to the refactor of the user settings, unsure why the data was not backfilled, I'll fix this in the next release.