huge number of database calls to duplicate entries in log_errors

Started by luiscamino, September 06, 2010, 05:03:25 PM

Previous topic - Next topic

luiscamino

i've a big mysterious error in my forums for over a year and i might be getting to the end of the tunnel.

for every single page load of the forum (for every user), the smf error log shows things like this:

Quote
http://www.clubsonyericsson.com/forum/index.php?/topic,3290.msg14974.html 
8: Undefined index: title
File: /home/cse/public_html/forum/Themes/forthemen3/index.template.php
Line: 680 

http://www.clubsonyericsson.com/forum/index.php?/topic,3290.msg14974.html 
8: Undefined index: href
File: /home/cse/public_html/forum/Themes/forthemen3/index.template.php
Line: 679

which of course is completely non-descriptive.

after checking with my server's technical service, who was able to dig in deeper, this is their reply.

Quote
After tracing the progress of php as it parses index.php it does look like it's trying to make a very large number of database calls to yabbse_log_errors in which apparently there's a duplicate entry. I believe you may need to contact the SMF developers for how to clear up this SMF database issue.

write(3, "\232\1\0\0\3\n\t\tINSERT INTO yabbse_log_errors(`id_member`, `log_time`, `ip`, `url`, `message`, `session`, `error_type`, `file`, `line`)\n\t\tVALUES\n\t\t\t(0, 1283802373, SUBSTRING(\'\', 1, 16), SUBSTRING(\'?\', 1, 65534), SUBSTRING(\'Error en la Base de Datos: Duplicate entry \\\'16777215\\\' for key 1\', 1, 65534), \'64cb14442b3ca2612786213a34186893\', \'database\', SUBSTRING(\'/home/cse/public_html/foro/Sources/Errors.php\', 1, 255), 150)", 414) = 414

It does this or something like it many tens of times and then eventually segfaults, probably due to memory use, but I can't tell for certain.

for stability reasons my server is only accessible to myself so i can't give you the link. i have two forums with this problem, and the one with the bigger database (+300mb) doesn't even load.

any ideas are more than welcome!

thank you
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

CapadY

When you want to attach the file /home/cse/public_html/forum/Themes/forthemen3/index.template.php with your next post I'll have a look at it tomorrow. (it's over midnight here now)
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

luiscamino

here it is. i also attach a screenshot of how the english forum (the one that still works probably since it's a lot smaller) which uses exactly the same template bar some text.

thank you.
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

CapadY

Can you also attach the file /sources/subs.php ?
It seems the problem is in your menubar.
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

luiscamino

luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

CapadY

There is something strange.

Normaly the whole menubar is declared in subs.php. In your case only the default SMF menu items are in there.
I'm wondering how you got the added menu-items as "Reviews",  "Software" and "Photos" in your menubar and where they are placed. Is this done by a MOD ?

I can tell you for sure the error is generated during handling the array with menu items, so it is quit logic the errors are generated every page view.
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

xenovanis

Because the searchbutton was removed from your Subs.php, the current action search2 when returning searchresults isn't valid anymore.

In /Sources/Subs.php find this

elseif ($context['current_action'] == 'search2')
$current_action = 'search';


replace with

/* elseif ($context['current_action'] == 'search2')
$current_action = 'search'; */


I modified your Subs.php, attached here  ;)
"Insanity: doing the same thing over and over again and expecting different results."

luiscamino

@capady,

thank you for your help. the added menu items are just added in the index.template left to the default menus, as you can see here:

<table class="catbg02" style="height:30px; margin-top:2px"><tr>
<td width=486 class="catbg022">

&nbsp;&nbsp;<img src="http://www.clubsonyericsson.com/forimages/arrowita.gif" align=absmiddle>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="http://www.clubsonyericsson.com/en/category/reviews/">&nbsp;&nbsp;Reviews&nbsp;&nbsp;</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="http://www.clubsonyericsson.com/en/category/rumours/">&nbsp;&nbsp;Rumours/Spy Photos&nbsp;&nbsp;</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="http://www.clubsonyericsson.com/en/category/software/">&nbsp;&nbsp;Software&nbsp;&nbsp;</A>&nbsp;&nbsp;&nbsp;&nbsp;
<A HREF="http://www.clubsonyericsson.com/en/category/videos/">&nbsp;&nbsp;Videos&nbsp;&nbsp;</A>

</td>

<td width=475 class="catbg022" nowrap>';
template_menu();

echo '</td></tr></table>


the smf buttons (admin, moderate, calendar, etc) are generated in subs.php in the line 3713, but i don't remember manually editing that area. do you see something wrong?

@xenovanis. thank you for spotting that. not sure it is the cause of the errors but i'm sure it will help :)
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

luiscamino

ok so i just manually dropped the errors table so that the duplicate error ceased and my big forum started working again, and i've freed all ip's from the firewall, so you can visit them now if you need:

www.clubsonyericsson.com/foro
www.clubsonyericsson.com/forum

i applied xenovanis's suggestion but the errors are still happening.
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

Alex' Manson

Quote from: luiscamino on September 08, 2010, 07:50:42 AM
ok so i just manually dropped the errors table so that the duplicate error ceased and my big forum started working again, and i've freed all ip's from the firewall, so you can visit them now if you need:

www.clubsonyericsson.com/foro
www.clubsonyericsson.com/forum

i applied xenovanis's suggestion but the errors are still happening.
NICE NEWS! :)

xenovanis

Do you have cache enabled? If so, try clearing it in Admin -> Maintenance -> Forum Maintenance.

If that doesn't work, switch to the default theme temporarily and see if the errors continue.
"Insanity: doing the same thing over and over again and expecting different results."

luiscamino

no i don't have cache enabled.

the errors eveidently don't occur with the default theme since, as capady has noted, this is an issue related to my theme
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

luiscamino

i tried something. completely substituting the menu part of subs.php with the original code from an untouched subs.php file.

specifically, everything from

Quote// All the buttons we can possible want and then some...

to

Quote// Now we put the buttons in the context so the theme can use them.

but the same errors are taking place, so this can't be the area with problems, right? any other ideas of where to look?
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

xenovanis

Most likely it's in your index.template.php, but I'm not sure where to look exactly. Any change you can contact the theme author about this?
"Insanity: doing the same thing over and over again and expecting different results."

luiscamino

well, i'm the theme autor :) one idea would be the classic alternative removal of big random chunks of code to see if the error stops appearing at some point... but that's no guarantee that i'll find it :/
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

xenovanis

I'd suggest starting with disecting this :P

echo '
<span id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
<a title="', $act, '" href="', $button['href'], '">
', ($button['active_button'] ? '' : ''), $button['title'], ($button['active_button'] ? '' : ''), '</a></span>';
}



It's the only entry where both ['href'] and ['title'] are used. Did you use this from another theme?
"Insanity: doing the same thing over and over again and expecting different results."

luiscamino

thanks for spotting that!

i think i did, a couple of years ago. the template is a carry-over from some standard theme from a pre 2.0 installation, i think, meaning that there could be some things that are handled differently in 2.0 rc1 (my version).

do you think i could transplant that part of of the template_menu function from the current release into my template?
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

luiscamino

ok, so compared to the code from my theme that @xenovanis showed up there, the default theme of my 2.0 rc1 installation shows this instead:


echo '
<li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
<a title="', $act, '" href="', $button['href'], '">
<span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
</a>
</li>';
}


it seems that i changed those < LI > to some < SPAN > and removed and some other tags, but it looks like something that would still work. can you spot the bug?
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

luiscamino

well, i tried replacing that chunk of the code with what i just posted (from the default theme which, if selected, doesn't show the errors) and the errors are still happening. must be somewhere else?
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

luiscamino

ok i removed that whole template_menu function and the errors dissapeared, so the problem is in there somewhere!
luis gonzález-camino calleja
www.luiscamino.com
www.avantglance.com
www.clubsonyericsson.com

Advertisement: