Claiming an existing method as undefined

abdfahim

Well-known member
I am a bit reluctant to post this as XF bug report, but @Siropu checked and confirmed that the claimed missing method exists in place.

I received this error 10-20 times each day for last 3 months or so. Recently I realized that 75% of the time this error coincide with "server max_user_connections limit reached" error.

However, there are ~25% of instances when this error appears stand-alone. Does it really relate to max_user_connections limit? If so, is there an explanation on 25% odd ones out?

Please feel free to move /close it if it's not a XF bug.

Error: Call to undefined method XF\Entity\User::canViewSiropuChat() src/addons/Siropu/Chat/Pub/Controller/Chat.php:20
Generated by: xyz Mar 5, 2018 at 1:00 AM

Stack trace
#0 src/XF/Pub/Controller/AbstractController.php(29): Siropu\Chat\Pub\Controller\Chat->preDispatchController('Update', Object(XF\Mvc\ParameterBag))
#1 src/XF/Mvc/Controller.php(117): XF\Pub\Controller\AbstractController->preDispatchType('Update', Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Controller->preDispatch('Update', Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('Siropu\\Chat:Cha...', 'Update', 'json', Object(XF\Mvc\ParameterBag), 'siropuChat', Object(Siropu\Chat\Pub\Controller\Chat), NULL)
#4 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#6 src/XF.php(328): XF\App->run()
#7 index.php(13): XF::runApp('XF\\Pub\\App')
#8 {main}

As an example, the red ones are stand alone

1520390019225.webp
 
Last edited:
I agree with @Siropu that it is likely that the class/method exists, but somewhere a long the line the class extension isn't loading. The causes for that could well be the maximum connections thing, and I'd recommend addressing that issue in the first instance. If you have some sort of caching layer, such as Redis or Memcached then it could be that which is falling over for similar reasons to the max connections problem. It would be this caching layer which the information about class extensions comes from as we store them in the xf_data_registry table OR inside the caching layer if that is configured. It'd probably be interesting to see the full output and stack trace of the max connections error when it coincides with the class extensions not being loaded to see if it is specifically falling over when requesting information from the registry.
 
I'd recommend addressing that issue in the first instance
Sure, I will do that asap as soon as I find some good alternative within my budget. My current shared hosting plan has max_user_connections = 18 and max_connections =150 and the provider is not going to increase that.

If you have some sort of caching layer, such as then it could be that which is falling over for similar reasons to the max connections problem.
I have not installed any such thing on top of XF. So unless XF has that by default, I don't have Redis or Memcached. Only caching happens with CloudFlare but I guess that only cache image, CSS and JS.

It'd probably be interesting to see the full output and stack trace of the max connections error when it coincides with the class extensions not being loaded to see if it is specifically falling over when requesting information from the registry.
If you meant stack trace from server log in ACP, here is an instance when those 2 errors occured together

max_user_connections said:
ErrorException: Fatal Error: Uncaught XF\Db\Exception: User xxxxx already has more than 'max_user_connections' active connections in /home/xxxxx/xxxxx/src/XF/Db/Mysqli/Adapter.php:160 Stack trace: #0 /home/xxxxx/xxxxx/src/XF/Db/Mysqli/Adapter.php(28): XF\Db\Mysqli\Adapter->makeConnection(Array) #1 /home/xxxxx/xxxxx/src/XF/Db/AbstractAdapter.php(51): XF\Db\Mysqli\Adapter->getConnection() #2 /home/xxxxx/xxxxx/src/XF/Db/Mysqli/Adapter.php(113): XF\Db\AbstractAdapter->connect() #3 /home/xxxxx/xxxxx/src/XF/Db/AbstractAdapter.php(410): XF\Db\Mysqli\Adapter->escapeString('options') #4 /home/xxxxx/xxxxx/src/XF/Db/AbstractAdapter.php(388): XF\Db\AbstractAdapter->quote('options') #5 /home/xxxxx/xxxxx/src/XF/DataRegistry.php(137): XF\Db\AbstractAdapter->quote(Array) #6 /home/xxxxx/xxxxx/src/XF/DataRegistry.php(82): XF\DataRegistry->readFromDb(Array, Array) #7 /home/xxxxx/xxxxx/src/XF/DataRegistry.php(225): src/XF/Db/Mysqli/Adapter.php:160
Generated by: Unknown account Mar 5, 2018 at 12:24 AM
Stack trace
#0 [internal function]: XF::handleFatalError()
#1 {main}

Request state
array(4) {
["url"] => string(22) "/index.php?chat/update"
["referrer"] => string(138) "https://www.xxxxx.com/threads/threadtitle.41379/page-3"
["_GET"] => array(1) {
["chat/update"] => string(0) ""
}
["_POST"] => array(11) {
["channel"] => string(4) "room"
["room_id"] => string(1) "1"
["last_id"] => array(1) {
[1] => string(4) "2013"
}
["conv_id"] => string(1) "0"
["conv_only"] => string(1) "0"
["conv_last_active"] => string(10) "1519714406"
["is_chat_page"] => string(5) "false"
["_xfRequestUri"] => string(109) "/threads/threadtitle.41379/page-3"
["_xfWithData"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
}
}


Class Error said:
Error: Call to undefined method XF\Entity\User::canViewSiropuChat() src/addons/Siropu/Chat/Pub/Controller/Chat.php:20
Generated by: Unknown account Mar 5, 2018 at 12:24 AM

Stack trace
#0 src/XF/Pub/Controller/AbstractController.php(29): Siropu\Chat\Pub\Controller\Chat->preDispatchController('Update', Object(XF\Mvc\ParameterBag))
#1 src/XF/Mvc/Controller.php(117): XF\Pub\Controller\AbstractController->preDispatchType('Update', Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Controller->preDispatch('Update', Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('Siropu\\Chat:Cha...', 'Update', 'json', Object(XF\Mvc\ParameterBag), 'siropuChat', Object(Siropu\Chat\Pub\Controller\Chat), NULL)
#4 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#5 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#6 src/XF.php(328): XF\App->run()
#7 index.php(13): XF::runApp('XF\\Pub\\App')
#8 {main}

Request state
array(4) {
["url"] => string(22) "/index.php?chat/update"
["referrer"] => string(76) "https://www.xxxxx.com/threads/threadtitle.42874/"
["_GET"] => array(1) {
["chat/update"] => string(0) ""
}
["_POST"] => array(11) {
["channel"] => string(4) "room"
["room_id"] => string(1) "1"
["last_id"] => array(1) {
[1] => string(4) "2013"
}
["conv_id"] => string(1) "0"
["conv_only"] => string(1) "0"
["conv_last_active"] => string(10) "1519975437"
["is_chat_page"] => string(5) "false"
["_xfRequestUri"] => string(47) "/threads/threadtitle.42874/"
["_xfWithData"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
}
}
 
In that case, it really does seem consistent with all being caused by the max_connections stuff. Obviously something like a chat application is going to exacerbate that, but the root cause definitely seems to be a lack of resources/connections.
 
Back
Top Bottom