SMFHacks.com

SMF Gallery Pro => Support => Topic started by: Vincent Volmer on December 27, 2020, 10:43:40 am

Title: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 10:43:40 am
Hello SMFHacks,

I hope you are fine these days!

We've updated our MariaDB 5.5 to 10.5 today and all though the forum is working fine, the gallery makes the database using 300% memory and we need to kill MariaDB, PHP and httpd and start them again to bring the website alive. We tried to check and correct the database but there are no issues found...... and the most irritating thing is that there are no errors, not in the SMF log, not in the server logs.

Most strange is that I can access the Gallery as an Admin without any issue but as any other member (or guest) it makes the whole website unreachable by an crash or 'freeze' from the database. And because we're still using the good old SMFGalleryPro version 5, I updated today to version 9beta but still having the same issue. So I needed to disable the Gallery for now.

Do you have any Idea and can you help me with this? Thank you so much!!

Vincent Volmer
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 10:49:37 am
When run can see any database queries running via phpmyadmin that are taking a long time?
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 11:33:37 am
I see one query with a long time..... :

SELECT max(com.ID_COMMENT) AS lastcomment, p.id_picture, p.commenttotal, p.totalratings, p.rating, p.filesize, p.views, p.thumbfilename, p.title, p.id_member, m.real_name, p.date, p.description, p.mature, c.view, v.id_picture as unread, mg.online_color, p.totallikes FROM (smf_gallery_pic as p, smf_gallery_comment as com) LEFT JOIN smf_members AS m ON (m.id_member = p.id_member) LEFT JOIN smf_membergroups AS mg ON (mg.ID_GROUP = IF(m.ID_GROUP = 0, m.ID_POST_GROUP, m.ID_GROUP)) LEFT JOIN smf_gallery_usersettings AS s ON (s.id_member = m.id_member) LEFT JOIN smf_gallery_catperm AS c ON (c.id_group IN (0,6) AND c.id_cat = p.id_cat) LEFT JOIN smf_gallery_log_mark_view AS v ON (p.id_picture = v.id_picture AND v.id_member = 5458 AND v.user_id_cat = p.USER_ID_CAT) WHERE com.id_picture = p.id_picture AND ( ((s.private = 0 || s.private IS NULL) AND (s.password = '' || s.password IS NULL) AND p.user_id_cat != 0 AND p.approved = 1) || (p.approved = 1 AND p.user_id_cat = 0 AND (c.view IS NULL || c.view = 1))) GROUP by p.id_picture ORDER BY lastcomment DESC LIMIT 12
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 11:40:20 am
Run this query and post back full results
Code: [Select]
EXPLAIN SELECT max(com.ID_COMMENT) AS lastcomment, p.id_picture, p.commenttotal, p.totalratings, p.rating, p.filesize, p.views, p.thumbfilename, p.title, p.id_member, m.real_name, p.date, p.description, p.mature, c.view, v.id_picture as unread, mg.online_color, p.totallikes FROM (smf_gallery_pic as p, smf_gallery_comment as com) LEFT JOIN smf_members AS m ON (m.id_member = p.id_member) LEFT JOIN smf_membergroups AS mg ON (mg.ID_GROUP = IF(m.ID_GROUP = 0, m.ID_POST_GROUP, m.ID_GROUP)) LEFT JOIN smf_gallery_usersettings AS s ON (s.id_member = m.id_member) LEFT JOIN smf_gallery_catperm AS c ON (c.id_group IN (0,6) AND c.id_cat = p.id_cat) LEFT JOIN smf_gallery_log_mark_view AS v ON (p.id_picture = v.id_picture AND v.id_member = 5458 AND v.user_id_cat = p.USER_ID_CAT) WHERE com.id_picture = p.id_picture AND ( ((s.private = 0 || s.private IS NULL) AND (s.password = '' || s.password IS NULL) AND p.user_id_cat != 0 AND p.approved = 1) || (p.approved = 1 AND p.user_id_cat = 0 AND (c.view IS NULL || c.view = 1))) GROUP by p.id_picture ORDER BY lastcomment DESC LIMIT 12
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 11:47:14 am
Hello,

please see attachment
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 11:57:58 am
After disabling "recent comments on index" the page is loading fine...
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 11:59:56 am

Yeah just was going to post that

I would disable the Recent Comments main page block under layout settings. That looks like the slowdown.

Not sure why mariadb is missing a key. I see in the explain the com table is Null


Test your stats page too in the gallery.
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 12:05:10 pm
Stats is looking good: please see  https://digiscrap.nl/gallery/?sa=stats
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 12:18:56 pm
Run this query too
Code: [Select]
show index from smf_gallery_comment
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 12:23:06 pm
Hereby
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 12:26:19 pm
Ok that's the issue.

Run
Code: [Select]
Alter table smf_gallery_comment ADD index id_picture (id_picture);

That recent comment query should work fast now hopefully
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: Vincent Volmer on December 27, 2020, 12:41:55 pm
Hello,

Thanks! Yes... it is working again. Thanks you! Is this error caused by the MariaDB upgrade?

Cheers! I'm really happy ;)
Title: Re: Hang after upgrade MariaDB to version 10.5
Post by: SMFHacks on December 27, 2020, 12:56:07 pm
No, was missing and index will fix for next update.