News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Subs.php and index.php time out issues

Started by mrhope, December 26, 2007, 06:34:34 PM

Previous topic - Next topic

mrhope

Version: SMF 1.1.2
Forum URL: http://www.computerhope.com/forum

When attempting to access the forums through the root directory or index.php I and all my members have been unable to access the forum. However, all sub pages and boards seem to be able to be accessed with no errors.

Because this issue happened by itself (forums have been working fine for the last several months) I assumed it to be an issue with the ISP. However, after spending much of the whole day on the phone with them they believe it's something to do with SMF.

Right now when the forums are not in maintenance mode the forums generate the below error most of the time.

Fatal error: Maximum execution time of 60 seconds exceeded in /home/users/c/comphope/public_html/forum/Sources/Subs.php on line 280

Other times the forums will time out.

Any ideas to what could be causing or things I can do to help isolate or identify the cause of the problem would be appreciated.


I have run:
Find and repair any errors
Optimize all tables to improve performance

Tried replacing the index.php and subs.php with backups.

I can still access admin mode just can't get through the main page (index.php).

greyknight17

Is your webhost your ISP also? It does look like a webhost issue. None of the SMF files should take more than 60 seconds to load.

Did you make any changes to your forum recently? Any mods installed?

mrhope

Thanks for the reply. I agree with you about it being an ISP issue, which is why I've spent so much time with them today. But haven't been able to get anywhere with them and in the past they've been good at resolving or finding issues that were their own.

Answers to your questions.
- Yes ISP is also my webhost.

- I have made no changes (ISP claims they haven't either). Forums have been running like a champ for the past few months.
- No mods installed.



mrhope

It is however really strange that you can access boards fine that I believe in part do use the index.php file but trying to go to the main page it doesn't work.

For example:

http://www.computerhope.com/forum/index.php/board,1.0.html = Works fine.

http://www.computerhope.com/forum/index.php/ = Time out.



mrhope

#4
Any additional ideas or thoughts on this issue and/or is thee a method I can determine what is causing the time out?

I looked at the subs.php file and I don't really think that the first line (being line 280) is causing a timeout.

$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{


I also ran a status.php on the SQL server and got the below results. Unfortunately I'm not a SQL expert so I'm not exactly sure if any of that is too drastic although a lot of the values do seem to be off according to the (should be's...)

MySQL statistics:
Connections per second:           9.4094                                   
Kilobytes received per second:    0.5302                                   
Kilobytes sent per second:        1.5984                                   
Queries per second:               463.87                                   
Percentage of slow queries:       0                                       
Opened vs. Open tables:           1456.3                  (should be <= 80)
Table cache usage:                1           (should be >= 0.5 and <= 0.9)
Key buffer read hit rate:         0.0506                (should be <= 0.01)
Key buffer write hit rate:        0.1241                                   
Thread cache hit rate:            26.422                 (should be >= 30 )
Thread cache usage:               0.25        (should be >= 0.7 and <= 0.9)
Temporary table disk usage:       0.2811                                   
Sort merge pass rate:             0.0001                                   
Query cache enabled:              1                                       
Query cache miss rate:            0.3319                                   
Query cache prune rate:           0.5952                (should be <= 0.05)

File can be accessed also at the below link for additional information.

http://www.computerhope.com/tools/status.php

mrhope

My webhost was able to help me resolve this issue. The issue ended up being caused by the amount of users I have and the birthdate query in the calander.php

Original code:
// Collect all of the birthdays for this month.  I know, it's a painful query.
$result = db_query("
SELECT ID_MEMBER, realName, YEAR(birthdate) AS birthYear, birthdate
FROM {$db_prefix}members
WHERE YEAR(birthdate) != '0001'
AND ($allyear_part
OR DATE_FORMAT(birthdate, '{$year_low}-%m-%d') BETWEEN '$low_date' AND '$high_date'" . ($year_low == $year_high ? '' : "
OR DATE_FORMAT(birthdate, '{$year_high}-%m-%d') BETWEEN '$low_date' AND '$high_date'") . ")
AND is_activated = 1", __FILE__, __LINE__);
$bday = array();


New section:
// Collect all of the birthdays for this month.  I know, it's a painful query.
# Thu Dec 27 15:14:54 MST 2007
#Bill@xm added "AND YEAR(birthdate) != '0000'", 4 lines down vVv, this query is not only painful, but also stupid.
# if the birthday is '0000-00-00', they dont need to be reminded.
$result = db_query("
SELECT ID_MEMBER, realName, YEAR(birthdate) AS birthYear, birthdate
FROM {$db_prefix}members
WHERE YEAR(birthdate) != '0001' AND birthdate != '0000-00-00'
AND ($allyear_part
OR DATE_FORMAT(birthdate, '{$year_low}-%m-%d') BETWEEN '$low_date' AND '$high_date'" . ($year_low == $year_high ? '' : "
OR DATE_FORMAT(birthdate, '{$year_high}-%m-%d') BETWEEN '$low_date' AND '$high_date'") . ")
AND is_activated = 1", __FILE__, __LINE__);
$bday = array();

greyknight17

Glad it worked out.

Topic marked as solved.

praii

#7
Occoured again on 1.1.7, sorry for digging this old topic up, still you should think whether you should change this querry :)
By the way mtop did not show any slow querries.

MostTimeOnline

I got the same issue.
The thing is - two sites (SMF), same host. One is much bigger and it works OK, while the other one is much smaller and has this issue! Both 1.1.7. with a few mods.
I really don't get it.

My host's support:
QuoteAn internal server error means the script you're
running sent the apache web server something it didn't understand. If
your scripts are using up too much system memory, they get killed by our
process watcher;

2008-12-29 15:05:57 procwatch2 INFO: Process(pid=11590, name='php5.cgi',
uid=xxxxyyyy(2175554), tty=None, cpu=9.1, rss=20952.0, vsize=35228.0):
kill for total RAM

That would cause the internal server errors you saw.
But it's not just that, they don't know what is causing this

QuoteFatal error: Maximum execution time of 30 seconds exceeded in /home/.dom/xxxyyy/mydomain.com/forum/Sources/Subs.php on line 280

Most Time Online

MostTimeOnline

#9
Oh.... the problem was the dagum CALENDAR!!! I just disabled it... and index.php now works as lighting!

Dunno why, but something went wrong with 1.1.7.... so people - just disable the calendar on your SMF, if you don't need it that much.


EDIT:  replaced 2 words with 1
Most Time Online

Advertisement: