XF 1.5 Intermittent undefined indexes

seph

Member
Hey,

I have a newly converted forum that's facing an issue of intermittent undefined index errors related to styles and languages. It will persist for a few minutes and then disappear for hours. I'm looking for ideas on what might cause this.

Version: 1.5.2
Background: Forum converted over from SMF

From the code it looks to be a corrupted array as both the $styles and $languages array passes the sanity checks and then is missing either the language_id index or the properties index.

This corrupted copy comes either from the registry or directly from the database/cache. I somehow doubt it gets corrupted while being fetched from either of those so perhaps something went wrong during the conversion from SMF to Xenforo? It's more likely that the cache or MySQL simply fails to return data but in that case it shouldn't pass the sanity checks.

I'm assuming based on the "Generated By: Unknown Account" that this is triggered by a guest rather than a logged-in user so it shouldn't be related to a poorly imported user account. (which makes the intermittent nature even weirder - unless this assumption is wrong.)

Since it's intermittent I also cannot reproduce this on local or staging so it's difficult for me to get more data about the state of the array.

Code:
Error Info
ErrorException: Undefined index: language_id - library/XenForo/Visitor.php:517
Generated By: Unknown Account, Today at 1:25 AM
Stack Trace
#0 /mnt/data/www/romulation/xenforo/library/XenForo/Visitor.php(517): XenForo_Application::handlePhpError(8, 'Undefined index...', '/mnt/data/www/r...', 517, Array)
#1 /mnt/data/www/romulation/xenforo/library/XenForo/Visitor.php(471): XenForo_Visitor->setVisitorLanguage(0)
#2 /mnt/data/www/romulation/xenforo/library/XenForo/Session.php(274): XenForo_Visitor::setup(false, Array)
#3 /mnt/data/www/romulation/xenforo/library/XenForo/Controller.php(293): XenForo_Session::startPublicSession(Object(Zend_Controller_Request_Http))
#4 /mnt/data/www/romulation/xenforo/library/XenForo/Controller.php(306): XenForo_Controller->_setupSession('Errornotfound')
#5 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(350): XenForo_Controller->preDispatch('Errornotfound', 'XenForo_Control...')
#6 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#7 /mnt/data/www/romulation/xenforo/index.php(13): XenForo_FrontController->run()
#8 {main}

Code:
Error Info
ErrorException: Undefined index: properties - library/XenForo/Dependencies/Public.php:303
Generated By: Unknown Account, Today at 1:25 AM
Stack Trace
#0 /mnt/data/www/romulation/xenforo/library/XenForo/Dependencies/Public.php(303): XenForo_Application::handlePhpError(8, 'Undefined index...', '/mnt/data/www/r...', 303, Array)
#1 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(580): XenForo_Dependencies_Public->preRenderView(Object(XenForo_ControllerResponse_Error))
#2 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Error), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#3 /mnt/data/www/romulation/xenforo/index.php(13): XenForo_FrontController->run()
#4 {main}

Code:
Error Info
ErrorException: Argument 2 passed to XenForo_Application::mapMerge() must be of the type array, boolean given, called in /mnt/data/www/romulation/xenforo/library/XenForo/Dependencies/Public.php on line 304 and defined -library/XenForo/Application.php:1172
Generated By: Unknown Account, Today at 1:25 AM
Stack Trace
#0 /mnt/data/www/romulation/xenforo/library/XenForo/Application.php(1172): XenForo_Application::handlePhpError(4096, 'Argument 2 pass...', '/mnt/data/www/r...', 1172, Array)
#1 /mnt/data/www/romulation/xenforo/library/XenForo/Dependencies/Public.php(304): XenForo_Application::mapMerge(Array, false)
#2 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(580): XenForo_Dependencies_Public->preRenderView(Object(XenForo_ControllerResponse_Error))
#3 /mnt/data/www/romulation/xenforo/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Error), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#4 /mnt/data/www/romulation/xenforo/index.php(13): XenForo_FrontController->run()
#5 {main}
 
What version of PHP are you running? (Are you running APC?) We do see some odd errors with PHP 5.4 and APC that appears to relate to opcode cache corruption.

Have you configured a cache in config.php? If so, what are you using?
 
I'd try dropping Memcached at least temporarily. (If you do this, it's worth restarting it before re-enabling in XenForo so stale data isn't served.) This data does seem to be elements that are served by Memcached, so it seems like the likely cause. Unfortunately, I'm not sure what issues that would point to (as it's not an issue we've had here for example). Is Memcached running on the localhost?
 
I'd try dropping Memcached at least temporarily. (If you do this, it's worth restarting it before re-enabling in XenForo so stale data isn't served.) This data does seem to be elements that are served by Memcached, so it seems like the likely cause. Unfortunately, I'm not sure what issues that would point to (as it's not an issue we've had here for example). Is Memcached running on the localhost?

I've added some logging of the array when the index is undefined so I will check that first when it happens again. Would rather have a fix than not use a cache.
 
Turns out it's definitely memcached. The returned array is
Code:
array (
  'stats_handler_class' => 'XenForo_StatsHandler_Attachment',
  'phrase_cache' => 
  array (
  ),
)

Also turns out the memcached instance was being restarted instead of issued a flush_all and this is when it happens. So not a huge issue. Xenforo doesn't detect that the returned cache data isn't valid, but meh, at least it's preventable by just not doing stupid things like restarting the memcached instance.
 
Top Bottom