XF 1.5 Error when rebuilding Master Data

Martok

Well-known member
I've just upgraded to 1.5.9. Following this I upgraded UI.X to 1.5.9 and when merging a particular template, I got a MySQL server has gone away error each time. I emptied much of the template and managed to save it, then decided that I would rebuild the master data just in case. However, this won't complete as each time I get this error:

Code:
Server Error

Error while sending QUERY packet. PID=XXXXX

XenForo_Application::handlePhpError()
mysqli->rollback() in Zend/Db/Adapter/Mysqli.php at line 444
Zend_Db_Adapter_Mysqli->_rollBack() in Zend/Db/Adapter/Abstract.php at line 523
Zend_Db_Adapter_Abstract->rollBack() in XenForo/Db.php at line 131
XenForo_Db::rollback() in XenForo/Db.php at line 155
XenForo_Db::rollbackAll() in XenForo/Model/Deferred.php at line 304
XenForo_Model_Deferred->runDeferred() in XenForo/Model/Deferred.php at line 429
XenForo_Model_Deferred->_runInternal() in XenForo/Model/Deferred.php at line 355
XenForo_Model_Deferred->runByUniqueKey() in XenForo/Install/Controller/Abstract.php at line 34
XenForo_Install_Controller_Abstract->_manualDeferredRunner() in XenForo/Install/Controller/Upgrade.php at line 221
XenForo_Install_Controller_Upgrade->actionRunDeferred() in XenForo/FrontController.php at line 351
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
XenForo_FrontController->run() in /.../install/index.php at line 18

(I've removed the actual PID and edited the path in the final line).


If I refresh the page at this point I arrive at the Upgrade complete screen. However each time I try to rebuild the master data I get the same error.

This is currently on my test site but I'd like to get this issue resolved (both this error and the MySQL server has gone away when merging a template - never ever had this before) before upgrading my live site.
 
Interestingly, someone else is having the same issue after upgrading to 1.5.9 and UI.X: https://xenforo.com/community/threads/ui-x-paid.57944/page-322#post-1085206
Yes, I saw that and the response that followed (check with a sysadmin). I currently have a support ticket in with my hosts as to why MySQL should go away (never happened before and I have a reasonable spec VPS for my small site).

I'm not sure how the issue with UI.X and MySQL server has gone away when merging a particular template could cause the error in the first post when rebuilding the Master Data?
 
It could simply be due to a timeout issue (as Mike intimated), as templates are saved in the database.

The common factor at least seems to be UI.X.
 
There are various other reasons for a "MySQL has gone away" error, though the wait_timeout is a big one: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html

Another option could be a potential bug in the style that causes it to create a massive template (too big for MySQL to save). What template did you have problems with when merging? Can you perhaps show the "default" version of it (the one from the style)?
 
There are various other reasons for a "MySQL has gone away" error, though the wait_timeout is a big one: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html

Another option could be a potential bug in the style that causes it to create a massive template (too big for MySQL to save). What template did you have problems with when merging? Can you perhaps show the "default" version of it (the one from the style)?

The default version of the template, uix_offCanvasSidebarNavigation, is simply this:

Code:
<nav>
<ul class="sidePanel__navTabs">

    <xen:include template="navigation">
        <xen:set var="$offCanvasNav">1</xen:set>
    </xen:include>

</ul>
</nav>

The version before this (which I'd made a minor customisation to add links, which are commented) is this:

Code:
<nav>
<ul class="sidePanel__navTabs">
    <!-- home -->
    <xen:if is="{$showHomeLink}">
        <li class="navTab home"><a href="{$homeLink}" class="navLink">{xen:phrase home}</a></li>
    </xen:if>


    <!-- extra tabs: home -->
    <xen:if is="{$extraTabs.home}">
    <xen:foreach loop="$extraTabs.home" key="$extraTabId" value="$extraTab">
        <xen:if is="{$extraTab.linksTemplate}">
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">

            <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
            <a href="{$extraTab.href}" class="SplitCtrl"><i class="uix_icon js-offcanvasIcon uix_icon-expandDropdown"></i></a>

            <div class="tabLinks">
                {xen:raw $extraTab.linksTemplate}
            </div>
        </li>
        <xen:else />
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">
                <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
            </li>
        </xen:if>
    </xen:foreach>
    </xen:if>


    <!-- forums -->
    <xen:if is="{$tabs.forums} AND ({$xenOptions.adnavigation_showForumsLink} OR !{$adnavigation})">
        <li class="navTab forums {xen:if $tabs.forums.selected, 'selected'}">

            <a href="{$tabs.forums.href}" class="navLink">{$tabs.forums.title}</a>
            <a href="{$tabs.forums.href}" class="SplitCtrl"><i class="uix_icon js-offcanvasIcon uix_icon-expandDropdown"></i></a>

            <div class="tabLinks">
                <ul class="blockLinksList">
                <xen:hook name="navigation_tabs_forums">
                    <xen:if is="{$visitor.user_id}"><li><a href="{xen:link 'forums/-/mark-read', $forum, 'date={$serverTime}'}" class="OverlayTrigger">{xen:phrase mark_forums_read}</a></li></xen:if>
                    <xen:if is="{$canSearch}"><li><a href="{xen:link search, '', 'type=post'}">{xen:phrase search_forums}</a></li></xen:if>
                    <xen:if is="{$visitor.user_id}">
                        <li><a href="{xen:link 'watched/forums'}">{xen:phrase watched_forums}</a></li>
                        <li><a href="{xen:link 'watched/threads'}">{xen:phrase watched_threads}</a></li>
                    </xen:if>
                    <xen:comment>SNR Start Add Featured Threads, Archive, Recent Activity and Recent Posts links to the navigation bar</xen:comment>
                        <xen:include template="cta_featuredthreads_navigation_links" />
                        <xen:if is="{$visitor.user_id}">
                        <xen:if is="{$xenOptions.enableNewsFeed}">
                            <li><a href="{xen:link recent-activity}">{xen:phrase recent_activity}</a></li>
                        </xen:if>
                            <li><a href="{xen:link find-new/posts, '', 'recent=1'}" rel="nofollow">{xen:phrase recent_posts}</a></li>
                        </xen:if>
                        <xen:comment>SNR End Add Recent Activity and Recent Posts links to the navigation bar</xen:comment>
                    <li><a href="{xen:link 'find-new/posts'}" rel="nofollow">{xen:if $visitor.user_id, {xen:phrase new_posts}, {xen:phrase recent_posts}}<xen:include template="unread_posts_count" /></a></li>
                </xen:hook>
                </ul>
            </div>
        </li>
    </xen:if>


    <!-- extra tabs: middle -->
    <xen:if is="{$extraTabs.middle}">
    <xen:foreach loop="$extraTabs.middle" key="$extraTabId" value="$extraTab">
        <xen:if is="{$extraTab.linksTemplate}">
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">

            <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
            <a href="{$extraTab.href}" class="SplitCtrl"><i class="uix_icon js-offcanvasIcon uix_icon-expandDropdown"></i></a>

            <div class="tabLinks">
                {xen:raw $extraTab.linksTemplate}
            </div>
        </li>
        <xen:else />
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">
                <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
            </li>
        </xen:if>
    </xen:foreach>
    </xen:if>


    <!-- members -->
    <xen:if is="{$tabs.members} AND ({$xenOptions.adnavigation_showMembersLink} OR !{$adnavigation})">
        <li class="navTab members {xen:if $tabs.members.selected, 'selected'}">

            <a href="{$tabs.members.href}" class="navLink">{$tabs.members.title}</a>
            <a href="{$tabs.members.href}" class="SplitCtrl"><i class="uix_icon js-offcanvasIcon uix_icon-expandDropdown"></i></a>

            <div class="tabLinks">
                <ul class="blockLinksList">
                <xen:hook name="navigation_tabs_members">
                    <li><a href="{xen:link members}">{xen:phrase notable_members}</a></li>
                    <xen:if is="{$xenOptions.enableMemberList}"><li><a href="{xen:link members/list}">{xen:phrase registered_members}</a></li></xen:if>
                    <li><a href="{xen:link online}">{xen:phrase current_visitors}</a></li>
                    <xen:if is="{$xenOptions.enableNewsFeed}"><li><a href="{xen:link recent-activity}">{xen:phrase recent_activity}</a></li></xen:if>
                </xen:hook>
                </ul>
            </div>
        </li>
    </xen:if>

    <!-- extra tabs: end -->
    <xen:if is="{$extraTabs.end}">
    <xen:foreach loop="$extraTabs.end" key="$extraTabId" value="$extraTab">
        <xen:if is="{$extraTab.linksTemplate}">
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">

            <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
            <a href="{$extraTab.href}" class="SplitCtrl"><i class="uix_icon js-offcanvasIcon uix_icon-expandDropdown"></i></a>

            <div class="tabLinks">
                {xen:raw $extraTab.linksTemplate}
            </div>
        </li>
        <xen:else />
            <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected'}">
                <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
            </li>
        </xen:if>
    </xen:foreach>
    </xen:if>

</ul>
</nav>


I couldn't merge them due to my customisation. There were syntax errors when trying to use anything other than resolve with parent, which gave the MySQL server has gone away error. Even when I deleted pretty much everything from the template and then saved (which worked), if I tried to then revert the customisation (ie go back to the default template) I got the same MySQL server has gone away error.


I reported the issue to my host who said that it typically this means that the max allowed packet value is too low in the MySQL config. This has now been increased and I have been able to install the master data and edit the template.

Strange that this should happen now. I've never had any problems like this before with my host in all of the upgrades/master data installs/add-on installs that I have done in the last few years.

I will report this to @Mike Creuzer so he is aware as this issue has happened to more than one person now.
 
This has now been increased and I have been able to install the master data and edit the template.
So that resolved it? That may fit with what I was thinking about a huge template being generated. That's the first time I've heard of that though, I think.
 
So that resolved it? That may fit with what I was thinking about a huge template being generated. That's the first time I've heard of that though, I think.
It certainly has resolved the error when rebuilding the master data.

The problematic template, uix_offCanvasSidebarNavigation, is now the original. Obviously I can't go through the resolving process again until I upgrade the live site (which I'm holding off for the moment due to this issue as well as a cosmetic style issue). However I have customised the template with the old code, then reverted it to the original there were no issues with this.
 
I am not sure if this will help, and it comes with the caveat that we really don't know what we're doing, but in case it helps others, we had this happen to us yesterday in this order:

We (foolishly) updated to the latest UI.X 1.5.9 before we had upgraded to XF 1.5.9. We received the "math error."

Then, realizing UI.X required XF 1.5.9, we uploaded the XF 1.5.9 upgrade files to our server.

We then attempted to run the XF 1.5.9 install routine (clicking on "Begin Upgrade" at /install/ page)

It made it through partially, then gave the "MySQL server has gone away" error.

We checked our MySQL config, and noticed that we had two entries for "max_allowed_packet" - one under [mysqld] and one under [mysqldump]. The [mysqld] value was 1M and the [mysqldump] value was 16M. We upped the [mysqld] value to 2M. The wait_timeout wasn't explicitly set in the file, but we checked how it was set, and it was at the default (28800). So everything seemed fine there.

We then soft rebooted the server.

Tried XF upgrade again. Same error.

Tried to get into ACP. It told us we had to "complete the upgrade".

Tried XF upgrade a third time. Same error.

From server command line, did 'service mysql restart'.

Tried XF upgrade again. Success!

Like I said we're in over our head on this stuff and have no idea why it happened like that (if it was the configuration file change that did it, then why wouldn't it have taken effect at reboot?) but if this helps you guys figure it out then great. :)
 
I still haven't updated to the latest UI.X, is this issue solved?
It's resolved for me, as I posted previously:

I reported the issue to my host who said that it typically this means that the max allowed packet value is too low in the MySQL config. This has now been increased and I have been able to install the master data and edit the template.

Whether there's anything that needs doing by @Mike Creuzer and the team to prevent this happening to anyone (or if they can do anything) I don't know. I'd suggest you do like I do, upgrade a test site (which should be a duplicate of your live site) first and see how it goes.
 
@Mike @Martok

Jake built a helper for the theme in a few places, so we're able to get this well under the 1mb default setting. So this should fix the issue for the future.

We'll post a patch shortly for those unable to change their max packet size.
 

Attachments

  • Screen Shot 2016-08-01 at 10.08.02 AM.webp
    Screen Shot 2016-08-01 at 10.08.02 AM.webp
    14.3 KB · Views: 12
Back
Top Bottom