XF 1.5 Mysqli statement execute error : Lock wait timeout exceeded; try restarting transaction

rafass

Well-known member
Accidentally I've edited a master template, but now, trying to edit the templates of my styles I'm getting this error:
Server Error: Mysqli statement execute error : Lock wait timeout exceeded; try restarting transaction
  • Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  • Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  • Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 661
  • Zend_Db_Adapter_Abstract->delete() in XenForo/DataWriter.php at line 1825
  • XenForo_DataWriter->_delete() in XenForo/DataWriter.php at line 1778
  • XenForo_DataWriter->delete() in XenForo/ControllerAdmin/Template.php at line 192
  • XenForo_ControllerAdmin_Template->actionDelete() in XenForo/FrontController.php at line 347
  • XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  • XenForo_FrontController->run() in /home/foro/public_html/admin.php at line 13
I can not do anything in the templates.
2.gif

and after wait a lot of time show me this error:
PHP:
Server Error Log
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry 'message_user_info-2' for key 'title_style_id' - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Rafass, A moment ago
Stack Trace
#0 /home/foro/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/foro/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/foro/public_html/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /home/foro/public_html/library/XenForo/DataWriter.php(1624): Zend_Db_Adapter_Abstract->insert('xf_template', Array)
#4 /home/foro/public_html/library/XenForo/DataWriter.php(1613): XenForo_DataWriter->_insert()
#5 /home/foro/public_html/library/XenForo/DataWriter.php(1405): XenForo_DataWriter->_save()
#6 /home/foro/public_html/library/XenForo/ControllerAdmin/Template.php(670): XenForo_DataWriter->save()
#7 /home/foro/public_html/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Template->actionSaveMultiple()
#8 /home/foro/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/foro/public_html/admin.php(13): XenForo_FrontController->run()
#10 {main}
Request State
array(3) {
  ["url"] => string(54) "https://my-syte/admin.php?templates/save-multiple.json"
  ["_GET"] => array(1) {
    ["templates/save-multiple_json"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["titleArray"] => array(2) {
      [261] => string(17) "message_user_info"
      [262] => string(21) "message_user_info.css"
    }
    ["styleidArray"] => array(2) {
      [261] => string(1) "0"
      [262] => string(1) "0"
    }
    ["templateArray"] => array(1) {
      [261] => string(4804) "<xen:require css="message_user_info.css" />

<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
<div class="messageUserBlock {xen:if $user.isOnline, online}">
    <xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <div class="avatarHolder">
            <span class="helper"></span>
            <xen:avatar user="$user" size="m" img="true" />
            <xen:if is="{$user.isOnline}"><span class="Tooltip onlineMarker" title="{xen:phrase online_now}" data-offsetX="-22" data-offsetY="-8"></span></xen:if>
            <div class="testing verified" rel="tooltip" data-offsetx="-4" title="Verified"></div>
            <!-- slot: message_user_info_avatar -->
        </div>
    </xen:hook>

<xen:if is="!{$isQuickReply}">
    <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
            {xen:helper userBanner, $user, 'wrapped'}
            <!-- slot: message_user_info_text -->
        </h3>
    </xen:hook>
    
    <xen:if hascontent="true">
        <div class="extraUserInfo">
            <xen:contentcheck>
            <xen:hook name="message_user_info_extra" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
                <xen:if is="@messageShowRegisterDate AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase joined}:</dt>
                        <dd>{xen:date $user.register_date}</dd>
                    </dl>
                </xen:if>
            
                <xen:if is="@messageShowMessageCount AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase messages}:</dt>
                        <dd><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}" class="concealed" rel="nofollow">{xen:number $user.message_count}</a></dd>
                    </dl>
                </xen:if>
            
                <xen:if is="@messageShowTotalLikes AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase likes_received}:</dt>
                        <dd>{xen:number $user.like_count}</dd>
                    </dl>
                </xen:if>
            
                <xen:if is="@messageShowTrophyPoints AND {$user.user_id} AND {$xenOptions.enableTrophies}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase trophy_points}:</dt>
                        <dd><a href="{xen:link 'members/trophies', $user}" class="OverlayTrigger concealed">{xen:number $user.trophy_points}</a></dd>
                    </dl>
                </xen:if>
        
                <xen:if is="@messageShowGender AND {$user.gender}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase gender}:</dt>
                        <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd>
                    </dl>
                </xen:if>
            
                <xen:if is="@messageShowOccupation AND {$user.occupation}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase occupation}:</dt>
                        <dd itemprop="role">{xen:string censor, $user.occupation}</dd>
                    </dl>
                </xen:if>
            
                <xen:if is="@messageShowLocation AND {$user.location}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase location}:</dt>
                        <dd><a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $user.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $user.location}</a></dd>
                    </dl>
                </xen:if>
        
                <xen:if is="@messageShowHomepage AND {$user.homepage}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase home_page}:</dt>
                        <dd><a href="{xen:string censor, $user.homepage, '-'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>
                    </dl>
                </xen:if>
                        
            </xen:hook>        
            <xen:if is="@messageShowCustomFields AND {$user.customFields}">
            <xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        
                <xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
                    <xen:if is="{$fieldInfo.viewable_message} AND ({$fieldInfo.display_group} != 'contact' OR {$user.allow_view_identities} == 'everyone' OR ({$user.allow_view_identities} == 'members' AND {$visitor.user_id}))">
                        <xen:if hascontent="true">
                            <dl class="pairsJustified userField_{$fieldId}">
                                <dt>{xen:helper userFieldTitle, $fieldId}:</dt>
                                <dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
                            </dl>
                        </xen:if>
                    </xen:if>
                </xen:foreach>
            
            </xen:hook>
            </xen:if>
            </xen:contentcheck>
        </div>
    </xen:if>
    
</xen:if>

    <span class="arrow"><span></span></span>
</div>
</div>"
    }
    ["addon_id"] => string(7) "XenForo"
    ["style_id"] => string(1) "2"
    ["template_id"] => string(3) "261"
    ["title_original"] => string(17) "message_user_info"
    ["_xfToken"] => string(8) "********"
    ["includeTitles"] => array(3) {
      [0] => string(17) "message_user_info"
      [1] => string(17) "message_user_info"
      [2] => string(21) "message_user_info.css"
    }
    ["_TemplateEditorAjax"] => string(1) "1"
    ["_xfRequestUri"] => string(58) "/admin.php?templates/message_user_info.261/edit&style_id=2"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

if I broke something, how can I fix it? :confused:
--
Edit, [Rebuilding master data....]
 
Last edited:
If you wait longer, it should clear itself. That said, it shouldn't really be explicitly happening. It's hard to say what specifically may have caused it in the first place. It could be the amount of work based on the template being edited (itself being a slow operation).
 
Everything was working perfect and fast, but after edit the master template (accidentally) it bring me all these errors.
I've rebuild the master data but now it take a lot of time (minutes) saving the changes, and give me a lot of errors.
2.gif
Before that was done very quick and without errors.
Looks I broke something editing the master template. Any suggestion?:notworthy:
 
Editing wouldn't cause something like that, at least not for an extended period of time. It would suggest that the load on your server is quite high and that would be causing the slowdown.
 
Thanks Mike, I'll take a look carefully into the server too.
Is weird, because I'm having problem only with the template I've edited. the other templates are working perfect.
but the problematic template give me:
PHP:
Server Error Log
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Lock wait timeout exceeded; try restarting transaction - library/Zend/Db/Statement/Mysqli.php:214
Generated By: Rafass, 2 minutes ago
Stack Trace
#0 /home/foro/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/foro/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/foro/public_html/library/XenForo/Model/Template.php(1753): Zend_Db_Adapter_Abstract->query('\r\n\t\t\t\t\tINSERT I...', Array)
#3 /home/foro/public_html/library/XenForo/DataWriter/Template.php(328): XenForo_Model_Template->buildTemplateMap('message_user_in...')
#4 /home/foro/public_html/library/XenForo/DataWriter.php(1409): XenForo_DataWriter_Template->_postSave()
#5 /home/foro/public_html/library/XenForo/ControllerAdmin/Template.php(670): XenForo_DataWriter->save()
#6 /home/foro/public_html/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Template->actionSaveMultiple()
#7 /home/foro/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /home/foro/public_html/admin.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(54) "https://mysite/admin.php?templates/save-multiple.json"
  ["_GET"] => array(1) {
    ["templates/save-multiple_json"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["titleArray"] => array(2) {
      [261] => string(17) "message_user_info"
      [262] => string(21) "message_user_info.css"
    }
    ["styleidArray"] => array(2) {
      [261] => string(1) "0"
      [262] => string(1) "0"
    }
    ["templateArray"] => array(1) {
      [261] => string(4804) "<xen:require css="message_user_info.css" />

<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person"> 
<div class="messageUserBlock {xen:if $user.isOnline, online}">
    <xen:hook name="message_user_info_avatar" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <div class="avatarHolder">
            <span class="helper"></span>
            <xen:avatar user="$user" size="m" img="true" />
            <xen:if is="{$user.isOnline}"><span class="Tooltip onlineMarker" title="{xen:phrase online_now}" data-offsetX="-22" data-offsetY="-8"></span></xen:if>
            <!-- slot: message_user_info_avatar -->
            <div class="foroio verified" rel="tooltip" data-offsetx="-4" title="Verified"></div>
        </div>
    </xen:hook>

<xen:if is="!{$isQuickReply}">
    <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
            {xen:helper userBanner, $user, 'wrapped'}
            <!-- slot: message_user_info_text -->
        </h3>
    </xen:hook>
     
    <xen:if hascontent="true">
        <div class="extraUserInfo">
            <xen:contentcheck>
            <xen:hook name="message_user_info_extra" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
                <xen:if is="@messageShowRegisterDate AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase joined}:</dt>
                        <dd>{xen:date $user.register_date}</dd>
                    </dl>
                </xen:if>
             
                <xen:if is="@messageShowMessageCount AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase messages}:</dt>
                        <dd><a href="{xen:link search/member, '', 'user_id={$user.user_id}'}" class="concealed" rel="nofollow">{xen:number $user.message_count}</a></dd>
                    </dl>
                </xen:if>
             
                <xen:if is="@messageShowTotalLikes AND {$user.user_id}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase likes_received}:</dt>
                        <dd>{xen:number $user.like_count}</dd>
                    </dl>
                </xen:if>
             
                <xen:if is="@messageShowTrophyPoints AND {$user.user_id} AND {$xenOptions.enableTrophies}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase trophy_points}:</dt>
                        <dd><a href="{xen:link 'members/trophies', $user}" class="OverlayTrigger concealed">{xen:number $user.trophy_points}</a></dd>
                    </dl>
                </xen:if>
         
                <xen:if is="@messageShowGender AND {$user.gender}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase gender}:</dt>
                        <dd itemprop="gender"><xen:if is="{$user.gender} == 'male'">{xen:phrase male}<xen:else />{xen:phrase female}</xen:if></dd>
                    </dl>
                </xen:if>
             
                <xen:if is="@messageShowOccupation AND {$user.occupation}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase occupation}:</dt>
                        <dd itemprop="role">{xen:string censor, $user.occupation}</dd>
                    </dl>
                </xen:if>
             
                <xen:if is="@messageShowLocation AND {$user.location}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase location}:</dt>
                        <dd><a href="{xen:link 'misc/location-info', '', 'location={xen:string censor, $user.location, '-'}'}" target="_blank" rel="nofollow" itemprop="address" class="concealed">{xen:string censor, $user.location}</a></dd>
                    </dl>
                </xen:if>
         
                <xen:if is="@messageShowHomepage AND {$user.homepage}">
                    <dl class="pairsJustified">
                        <dt>{xen:phrase home_page}:</dt>
                        <dd><a href="{xen:string censor, $user.homepage, '-'}" rel="nofollow" target="_blank" itemprop="url">{xen:string censor, $user.homepage}</a></dd>
                    </dl>
                </xen:if>
                         
            </xen:hook>         
            <xen:if is="@messageShowCustomFields AND {$user.customFields}">
            <xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
         
                <xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
                    <xen:if is="{$fieldInfo.viewable_message} AND ({$fieldInfo.display_group} != 'contact' OR {$user.allow_view_identities} == 'everyone' OR ({$user.allow_view_identities} == 'members' AND {$visitor.user_id}))">
                        <xen:if hascontent="true">
                            <dl class="pairsJustified userField_{$fieldId}">
                                <dt>{xen:helper userFieldTitle, $fieldId}:</dt>
                                <dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
                            </dl>
                        </xen:if>
                    </xen:if>
                </xen:foreach>
             
            </xen:hook>
            </xen:if>
            </xen:contentcheck>
        </div>
    </xen:if>
     
</xen:if>

    <span class="arrow"><span></span></span>
</div>
</div>"
    }
    ["addon_id"] => string(7) "XenForo"
    ["style_id"] => string(1) "1"
    ["template_id"] => string(3) "261"
    ["title_original"] => string(17) "message_user_info"
    ["_xfToken"] => string(8) "********"
    ["includeTitles"] => array(3) {
      [0] => string(17) "message_user_info"
      [1] => string(17) "message_user_info"
      [2] => string(21) "message_user_info.css"
    }
    ["_TemplateEditorAjax"] => string(1) "1"
    ["_xfRequestUri"] => string(58) "/admin.php?templates/message_user_info.261/edit&style_id=1"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
If that's still happening, you'll want to start looking at the server load and the MySQL process list (SHOW PROCESSLIST; query). There really isn't a reason for that to still be running/connected.
 
This error is caused (on my case)(and after many tests) when there are many languages / styles running.
on my case: 2 styles and 25 languages.:coffee:
Editing certain templates as: message_user_info or editing phrases.
take a lot of time and you never see that message in the top: "Saved successfully"
just take long time. and generate this server error.
and this only happen in some templates, because saving changes in others, the changes are saved very fast.
 
Top Bottom