• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Server error log

Lee

Well-known member
#1
I have found multiple instances of this in my server error log which have appeared over night.

Never been seen before last night.

Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Field 'link_id' doesn't have a default value - library/Zend/Db/Statement/Mysqli.php:214
 

Chris D

XenForo developer
Staff member
#2
It’s likely from an add on as we don’t have any tables with a link_id field.

In actual fact it could be from an add on you have recently disabled - it sounds like a field has been added to a database which didn’t have a default value set but the add on’s code was making sure it was set but now that code isn’t running.

If you have any disabled add ons which are anything to do with links then it could be the culprit.
 

Lee

Well-known member
#4
@Chris D - I have found a xf table with link_id field.

xf_link_proxy - It has the following structure:

link_idurlurl_hashfirst_request_datelast_request_datehits

Is this not a default field?
 

Lee

Well-known member
#6
#0 /home/helpmind/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/helpmind/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/helpmind/public_html/library/XenForo/Model/LinkProxy.php(43): Zend_Db_Adapter_Abstract->query('\n\t\t\tINSERT INTO...', Array)
#3 /home/helpmind/public_html/library/XenForo/ProxyOutput.php(357): XenForo_Model_LinkProxy->logVisit('https://themigh...')
#4 /home/helpmind/public_html/library/XenForo/ProxyOutput.php(197): XenForo_ProxyOutput->_outputLinkRedirect(false)
#5 /home/helpmind/public_html/library/XenForo/ProxyOutput.php(426): XenForo_ProxyOutput->output()
#6 /home/helpmind/public_html/proxy.php(12): XenForo_ProxyOutput::run()
#7 {main}
 

Mike

XenForo developer
Staff member
#7
That is the link proxy then, but it indicates that the table doesn't have the expected structure -- it's missing the auto_increment definition at the least.

We've seen this happen with bad backups and restores, but it could well affect other tables too, which means a fix isn't necessarily simple. Have you restored your DB recently? Changed servers?
 

Lee

Well-known member
#8
Not within the last say, 2 months.

The errors only occured yesterday.

My host might of had issues and restored a backup, I will check with them as we had some downtime last night.
 

Lee

Well-known member
#9
How do I go about repairing this individual issues, then I can fix as and when the errors show themselves (if they do!).
 

Mike

XenForo developer
Staff member
#10
It can potentially be complex. In this instance, you'd likely need to compare the xf_link_proxy table schema between your instance and the expected/default instance and make sure they match (aside from any expected changes by add-ons).
 

Lee

Well-known member
#11
I have restored that table from a copy of my backup from last night.

Thank you for pointing me to the right place, I will let you know if this happens again.

Is there a script anywhere that checks the integrity of the database?

I expect not because that would likely be a very complex thing to check?
 

Mike

XenForo developer
Staff member
#12
It is fairly difficult to check and effectively impossible when it comes to add-ons being involved (at least as something that we could provide). There are some tools for schema comparison that you could potentially use, but it would definitely require interpretation of the results to determine if the differences are expected (or insignificant).
 

Lee

Well-known member
#13
A new one for you to diagnose, @Mike.

When trying to upload.

Something certainly untoward has gone on with my installation and i'm not sure what it is.

ErrorException: Undefined index: data_id - library/XenForo/Model/Attachment.php:241

and the stack trace:

#0 /home/helpmind/public_html/library/XenForo/Model/Attachment.php(241): XenForo_Application::handlePhpError(8, 'Undefined index...', '/home/helpmind/...', 241, Array)
#1 /home/helpmind/public_html/library/XenForo/DataWriter/AttachmentData.php(217): XenForo_Model_Attachment->getAttachmentDataFilePath(Array)
#2 /home/helpmind/public_html/library/XenForo/DataWriter/AttachmentData.php(144): XenForo_DataWriter_AttachmentData->_writeAttachmentFile('/tmp/phpVd4juN', Array)
#3 /home/helpmind/public_html/library/XenForo/DataWriter.php(1423): XenForo_DataWriter_AttachmentData->_postSave()
#4 /home/helpmind/public_html/library/XenForo/Model/Attachment.php(539): XenForo_DataWriter->save()
#5 /home/helpmind/public_html/library/XenForo/ControllerPublic/Attachment.php(205): XenForo_Model_Attachment->insertUploadedAttachmentData(Object(XenForo_Upload), 360)
#6 /home/helpmind/public_html/library/XenForo/FrontController.php(351): XenForo_ControllerPublic_Attachment->actionDoUpload()
#7 /home/helpmind/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /home/helpmind/public_html/index.php(13): XenForo_FrontController->run()
#9 {main}

Request state:

array(3) {
["url"] => string(108) "https://helpmindsheal.com/attachmen...108ac6718c106f50229fb8b8d58&content_type=post"
["_GET"] => array(2) {
["hash"] => string(32) "9c581108ac6718c106f50229fb8b8d58"
["content_type"] => string(4) "post"
}
["_POST"] => array(13) {
["_xfToken"] => string(8) "********"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
["_xfSessionId"] => string(32) "4acf42026d25341245a400f34dc64932"
["content_data"] => array(1) {
["post_id"] => string(4) "4745"
}
["flowChunkNumber"] => string(1) "1"
["flowChunkSize"] => string(10) "4294967296"
["flowCurrentChunkSize"] => string(4) "3700"
["flowTotalSize"] => string(4) "3700"
["flowIdentifier"] => string(20) "3700-greenpadlockpng"
["flowFilename"] => string(17) "green padlock.png"
["flowRelativePath"] => string(17) "green padlock.png"
["flowTotalChunks"] => string(1) "1"
}
}
 

Mike

XenForo developer
Staff member
#14
Now it would appear that you're missing a fundamental column from a table. This really isn't something that can be recovered as the specific values in it are very important.

You mentioned downtime. You may need to contact your host to get an idea of what happened as it certainly looks like the structure of your database was modified.

It's very possible the only solution will be to restore from a backup.
 

Lee

Well-known member
#16
Update: my hosting provider is reverting to a backup taken just before yesterdays down time. Hopefully that resolves my issues. I've closed my community down for the evening to prevent lost data.
 

Lee

Well-known member
#17
@Mike, backup has been restored and all existing issues have been eradicated.

Seems like when the server came back online after the crash the database structure was destroyed slightly.