News:

Wondering if this will always be free?  See why free is better.

Main Menu

Cannot delete topic (RC2)

Started by Simon9863, December 31, 2005, 06:43:50 PM

Previous topic - Next topic

Simon9863

Hi All,

Just upgraded to RC2 on a fedora 4 server, running php511 and mysql 5.018

I've always used the default mysql rpm packages and have never had problems, yet when trying to delete a topic, then i am getting this error

Database Error: Lost connection to MySQL server during query
File: pathto/forum/Sources/RemoveTopic.php
Line: 355Database Error: MySQL server has gone away
File: pathto/forum/Sources/Load.php
Line: 1886"

Also, when deleting a reply to a topic, then i get a blank screen, yet the reply is deleted...


I have no problems with any other function in the software, so wonder whether this is really an incorrect server configuration, as suggested in the help pages here etc.

I hyave no mods installed, and these are the official mysql rpm's not the redhat versions.

Can anyone possibly give me some idea's on this one please ?

Many thanks,
Regards
Simon

JayBachatero

Make sure that all files got overwriten. 
In your admin panel click on (more info) and it will tell you if your files are up to date.

-JayBachatero
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Simon9863

Hi there, every file is up to date and was overwritten before the upgrade, yet we're still having these problems, sadly :(


Hope the answer is out there somewhere :)

Thanks again,
Regards
Simon

JayBachatero

I will report this to a Dev so that he can take a closer look into this.

-JayBachatero
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Grudge

Simon,

That's a little odd - same message each time?

This query:

db_query("
DELETE FROM {$db_prefix}messages
WHERE ID_TOPIC $condition", __FILE__, __LINE__);


Seems to be causing it, but it's not a difficult one. How large is your forum? If you'd be so kind as to provide me with an admin account and phpMyAdmin access I may have a better change of debugging it.

Cheers,

Grudge
I'm only a half geek really...

Simon9863

Thanks, Grudge

I've sent you a PM with the relevent access details as per you request. Hope you can find the cause of this problem !


Many thanks :)
Regards
Simon

Grudge

#6
Simon,

I've fixed it, but I think this *may* actually be a bug with the MySQL you are running. I basically worked around it. It was actually an attachments query which was failing. Whenever using WHERE attachmentType = in the query, it lost connection to the server. I fixed it by changing these lines in RemoveTopic.php:

removeAttachments('a.attachmentType = '0' AND m.ID_TOPIC ' . $condition, 'messages');


To:

removeAttachments('a.attachmentType = \'0\' AND m.ID_TOPIC ' . $condition, 'messages');


However, that should NOT be needed, it's effectively casting the 0 as a string, although attachmentType is an integer - very, very odd.

Grudge

EDIT:  You need to make these changes to Post.php file.
Find a.attachmentType = 0
Replace a.attachmentType = \'0\'
I'm only a half geek really...

Simon9863

Thats great work Grudge !


Many, many thanks for finding this error.

These are official MySQL Rpm's as on MySQL's website, so should i report this as a mysql bug do you think ? If so, then how would i describe this to them ?


Many thanks again, i really was clueless on this one !

Regards
Simon

Grudge

#8
The query that failed was this:

SELECT
a.filename, a.attachmentType, a.ID_ATTACH, a.ID_MEMBER, a.ID_MSG,
IFNULL(thumb.ID_ATTACH, 0) AS ID_THUMB, thumb.filename AS thumb_filename, thumb_parent.ID_ATTACH AS ID_PARENT
FROM (cvssmf_attachments AS a)
LEFT JOIN cvssmf_attachments AS thumb ON (thumb.ID_ATTACH = a.ID_THUMB)
LEFT JOIN cvssmf_attachments AS thumb_parent ON (a.attachmentType = 3 AND thumb_parent.ID_THUMB = a.ID_ATTACH)
WHERE a.attachmentType = 0
AND a.ID_MSG = 2230

So could ask them why. I'll upgrade my MySQL install a sec and see if it breaks for me...

Update: Upgraded MySQL to 5.0.18-nt and worked fine :/
I'm only a half geek really...

Simon9863

Hmmm, i used the generic Linux x86 RPM's, as i don't run Windows on my server.


I wonder if anyone else has had a problem with these RPM's, apart from me ?


korruption

I had the same problem, I made the change that Grudge suggested to the RemoveTopic.php that fixed it. Then after trying to modify a post I ran into the same problem with the Post.php file.
So I disabled attachments on the board and all the problems went away.

I am running PHP 5.1.1, MySQL 5.0.18 and Apache 2.2.0 on Debian 3.1.
PHP and Apache were installed from source MySQL is latest bin dist.

I dont know if the prob is with MySQL 5 or what as I havent had a chance to test it with 4.1.

tiko

#11
Hello,

Digging up an old topic here, but I'm having the same problem as apparently many others are having.  I'm receiving the same error, but additionally the error is causing my mysql server to restart itself, as well as some other quirks that cause the post count to be completely inaccurate.  Also, any other posts in the category are hidden (seemingly removed) until I recount forum totals/stats from within the admin panel.

My configuration is:
FreeBSD 6.0
Apache 2.0.55
PHP 4.4.2
MySQL 5.0.19, built with FreeBSD ports

I have not applied Grudge's fix yet, but was curious if any progress has been made to track down this problem.

Thanks.

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

JuhaS14

I have tried with 5.0.19 and 5.0.18 Mysql and get same error in Debian.

JuhaS14

Same kind of problem when i try to remove post (not topic), it deleted post but gives me error message:

Tietokantavirhe: MySQL server has gone away
Tiedosto: /var/www/forum/Sources/Subs.php
Rivi: 419Tietokantavirhe: MySQL server has gone away
Tiedosto: /var/www/forum/Sources/Load.php
Rivi: 1886

JayBachatero

Can you please port a copu of your Load.php?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert


JayBachatero

Sorry wrong file.  It's RemoveTopic.php
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert


Kuzmitch

I have probably the same problems with the configuration. Please look at this topic: http://www.simplemachines.org/community/index.php?topic=79005.0

This fix (removeAttachments('a.attachmentType = \'0\' AND m.ID_TOPIC ' . $condition, 'messages');) was applied already.

Thankx!

Kuzmitch

Solved! I have searched through all files which include "attachmentType" and fixed slashes. Now it works!

JayBachatero

JahaS you forgot to change this one.

        // Delete attachment(s) if they exist.
        require_once($sourcedir . '/ManageAttachments.php');
        removeAttachments('a.attachmentType = 0 AND a.ID_MSG = ' . $message);  <====
    }
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

MadPax

Well thnx guys for the help and Xenovanis to point me here.

I did solve my problem apparantely, but I would really like to have a precise list of files and lines to alter in order to not to have any flaws in the future before doing this on my live site.

Anyone know exactly? I think this would serve other not so sure user types.

Thanx in advance,
Pax

tethead

i'm having the same problem, so i did the fix in the RemoveTopic.php but still had other problems with Subs.php so i just disabled attachments on our boards until further notice. 

can somebody please post an exact list of the files that need to be changed as a workaround to this MySQL bug, and what needs to be changed?

guess i should have read here before upgrading from MySQL 4.x to 5.x
week4paug.net - a website for all things PHiSH

JayBachatero

Did you edit both places that you had to edit?  That link that you are searching for comes out twice in that file.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

tethead

it fails at line 419 of Subs.php , and i don't see anything dealing with attachments to edit around that... 

if you can please provide details for a semi-n00b on which files to change and what to change, i'd be very much appreciative!
week4paug.net - a website for all things PHiSH

tethead

btw, i'm running version 5.0.19 or MySQL and SMF 1.1 RC2 on a Debian (Sarge) server. 
week4paug.net - a website for all things PHiSH

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Simon9863

Hmm, I upgraded to mysql 5.0.20 today and suddenly I can delete and modify again without problems.
Hopefully this bug has been solved, even though the MySQL bug report doesn't say this has been fixed.
Can anyone else having this problem verify that the bug has gone away with 5.0.20 ?

If so, then i'll add that to the bug submission at mySQL and close the report.

Thanks
Regards
Simon

tiko

Simon, after reading your post I upgraded my mysql installation to 5.0.20 as well.  I can confirm that the problem is gone using 5.0.20 (RC2 w/ most recent patch).

tethead

week4paug.net - a website for all things PHiSH

Tikkas

I have the same problem. I fixed the reomovetopic and it worked fine after that.

Today however I wanted to edit a reply with and attach in it and got the same thing.
So I looked for the code in Post.php and changed it there too:

removeAttachments('a.attachmentType = '/0/' AND a.ID_MSG = ' . (int) $_REQUEST['msg'] . ' AND a.ID_ATTACH NOT IN (' . implode(', ', $del_temp) . ')');

That fixed the problem.

Just thought I would share it  ;)

cheers

Tikkas

Prime_8

this code will cause your forum to remove all attachments
Quote from: Tikkas on May 10, 2006, 06:10:21 AM
removeAttachments('a.attachmentType = '/0/' AND a.ID_MSG = ' . (int) $_REQUEST['msg'] . ' AND a.ID_ATTACH NOT IN (' . implode(', ', $del_temp) . ')');

to fix simply use teh patter set  in earlier post
removeAttachments('a.attachmentType = \'0\' AND a.ID_MSG = ' . (int) $_REQUEST['msg'] . ' AND a.ID_ATTACH NOT IN (' . implode(', ', $del_temp) . ')');

see the diff ?

this will alow for safe removal of  an attachment from just the one post you are editing not every post in the forum .  ;)


mimicria

I have some messages about server down and lost connection with mysql

I use Mysql 5.0.18 and php 5 on linux server on SuSe 10.1 (SMF 1.1 RC2)

After reading some post on this site a solve all problems with my forum. Thanks for all authors !

You can solve problems:

Changing in ManageAttachments.php, Removetopics.php and maybe in other files ...

a.attachmentType = 0 AND m.ID_TOPIC

to

a.attachmentType = \'0\' AND m.ID_TOPIC

and changing in Removetopics.php (in my file line 557)

LEFT JOIN {$db_prefix}attachments AS thumb_parent ON (a.attachmentType = 3 AND thumb_parent.ID_THUMB = a.ID_ATTACH)

with no sumbols (') !

to
LEFT JOIN {$db_prefix}attachments AS thumb_parent ON (a.attachmentType = '3' AND thumb_parent.ID_THUMB = a.ID_ATTACH)

mxw65

Quote from: Grudge on January 01, 2006, 01:28:17 PM

removeAttachments('a.attachmentType = '0' AND m.ID_TOPIC ' . $condition, 'messages');

To:

removeAttachments('a.attachmentType = \'0\' AND m.ID_TOPIC ' . $condition, 'messages');


Thanks a million. This fix worked for me as well.

auroris

Same problem here; the issues were that I could not edit a post containing an attachment and could not remove a topic. Grudge's fix worked. I am running Simplemachines 1.1.1; MySQL 5.1.6 on FreeBSD 6; PHP 5.2.0.

As an aside, an unmodified install of Simple Machines 1.0.10 on the same server using has no problems with attachments whatsoever.

HakTom

I can confirm this too.

running SMF 1.1.1, Mysql 5.0.18 on Debian, PHP 4.3.10

rulaman

Quote from: Grudge on January 01, 2006, 01:28:17 PM
Simon,

I've fixed it, but I think this *may* actually be a bug with the MySQL you are running. I basically worked around it. It was actually an attachments query which was failing. Whenever using WHERE attachmentType = in the query, it lost connection to the server. I fixed it by changing these lines in RemoveTopic.php:

removeAttachments('a.attachmentType = '0' AND m.ID_TOPIC ' . $condition, 'messages');


To:

removeAttachments('a.attachmentType = \'0\' AND m.ID_TOPIC ' . $condition, 'messages');


However, that should NOT be needed, it's effectively casting the 0 as a string, although attachmentType is an integer - very, very odd.

Grudge

EDIT:  You need to make these changes to Post.php file.
Find a.attachmentType = 0
Replace a.attachmentType = \'0\'


I had the same problem with my SMF 1.1.4.

Thanks for this workaround, it works fine ! ;)

Advertisement: