Tuesday 27 September 2011

Webpages which break in the night.

Our xPapers site seemed to be working fine last night when I left work. When I came in this morning it had broken. Loading the homepage showed the error "Oops an error has occurred". From my desktop PC (where i'd left myself logged in with an admin account) I also got a debug message:


Can't call method "threads_o" without a package or object reference at /home/xpapers/sites/fwshub/mason/news.html line 11.

...
7:
8: <%perl>
9:
10: my $f = xPapers::Forum->get(7);
11: my @threads = $f->threads_o("true","ct desc",0,2);
12: for my $p (map { $_->firstPost } @threads) {
13: my ($c1,$c2) = $rend->wordSplit($p->body,30);
14: #$c1 =~ s/<\/?a[^>]*>?//ig;
15: my $follow = $c2 ? " (read more)" : "";


My first thought was that one of the changes i'd made yesterday to a Mason page hadn't actually appeared yesterday due to the way Mason cache's things and that the cache had now expired revealing an error. So I tried removing all the changes I made yesterday and the error persisted. I then realised it only appeared on the home page and that I could access other pages. I then looked at the forums table and noticed that there was no entry number 7 which the error page indicated it was trying to access. I changed this number to one of a forum which really exists and the error went away. I've still no idea why this happened and if there was ever an entry number 7 in the database. Looking at the Apache logs nobody seems to have been on the site overnight and deleted an entry. I've now turned on query logging in MySQL and am about to setup a daily backup script so that we can at least take a diff of the database between two days and spot changes.

No comments:

Post a Comment