Advertisement:

Author Topic: Getting random error messages on my forum  (Read 6629 times)

Offline Mikeric

  • Semi-Newbie
  • *
  • Posts: 70
Getting random error messages on my forum
« on: April 26, 2013, 12:22:51 PM »
I am randomly getting error messages on my forum. If you go back and reload the page they go away and it loads fine. This is what I am getting.

Quote
Warning: require(/nfs/c04/h04/mnt/164532/domains/newenglandmustangs.co/html/cache/data_98dbfa6cb9409166f61c1deaff927320-SMF-modSettings.php) [function.require]: failed to open stream: No such file or directory in /nfs/c04/h04/mnt/164532/domains/newenglandmustangs.co/html/Sources/Load.php on line 2715

Fatal error: require() [function.require]: Failed opening required '/nfs/c04/h04/mnt/164532/domains/newenglandmustangs.co/html/cache/data_98dbfa6cb9409166f61c1deaff927320-SMF-modSettings.php' (include_path='.:/usr/local/php-5.3.15/share/pear') in /nfs/c04/h04/mnt/164532/domains/newenglandmustangs.co/html/Sources/Load.php on line 2715

I have these mods installed.

1.     Ad Managment    3.0.1     
2.   Sitemap    2.2.0   
3.   Google Analytics Code    1.4     
4.   Tapatalk SMF 2.0 RC5/Final Plugin    3.5.0     
5.   Add Facebook Like, Tweet, and Google +1    1.0.3a     
6.   Aeva ~ Auto-Embed Video & Audio    7.2     

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Getting random error messages on my forum
« Reply #1 on: April 26, 2013, 12:48:40 PM »
Hi, don't quite know why that's happening since the file is checked for existence before it's required.

In Load.php, that line should be the following:

Code: [Select]
require($cachedir . '/data_' . $key . '.php');

Change the "require" to "include". That should take care of the errors happening.

But the question is why is this happening. Are your forums very busy?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

MrPhil

  • Guest
Re: Getting random error messages on my forum
« Reply #2 on: April 26, 2013, 01:17:01 PM »
The SMF cache system frequently breaks. Either from your Admin or your file manager clear out all the data_*.php files in the cache directory. Leave index.php and .htaccess.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #3 on: April 26, 2013, 01:18:08 PM »
Here's the bit I don't get. Just before that require statement is a file_exists() check. How can it pass the file_exists() but not exist a statement or so later?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Getting random error messages on my forum
« Reply #4 on: April 26, 2013, 01:21:13 PM »
Cache files do get locked when they are written to. Can they be required when they are locked?

Only thing I can think of. ???

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #5 on: April 26, 2013, 01:28:09 PM »
No, that won't do it, LOCK_EX will not cause a file-not-found error as given above.

I suppose it could be some kind of weird race condition, but it never happens frequently enough or repeatably enough to diagnose properly.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #6 on: April 26, 2013, 01:38:55 PM »
Here's the bit I don't get. Just before that require statement is a file_exists() check. How can it pass the file_exists() but not exist a statement or so later?

Possibly because of this:

Quote from: http://php.net/manual/en/function.file-exists.php
    Note: The results of this function are cached. See clearstatcache() for more details.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #7 on: April 26, 2013, 01:42:55 PM »
Yes, but the cache life on that is not actually very long.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #8 on: April 26, 2013, 02:17:55 PM »
For as long as two checks happen for the same file within the lifetime of a single script, I don't see why not. Straightforward to check though. Just clear the cache after, say
Code: [Select]
// Okay, let's go for it memcached! and see if that fixes it. If so, look to see which mod tried to access it the first time around.

Easy to undo if it doesn't help.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #9 on: April 26, 2013, 02:21:33 PM »
Quote
For as long as two checks happen for the same file within the lifetime of a single script

But different things are checked each call to cache_get_data for the file cache. It actually has more of the symptoms of a race condition than anything else.

But yeah, it's worth a try I guess. I've never been able to reproduce it myself.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kays

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,973
  • Gender: Male
    • Kayssplace
Re: Getting random error messages on my forum
« Reply #10 on: April 26, 2013, 02:30:29 PM »
No, that won't do it, LOCK_EX will not cause a file-not-found error as given above.

Didn't thinks so. ::)

For as long as two checks happen for the same file within the lifetime of a single script, I don't see why not. Straightforward to check though. Just clear the cache after, say
Code: [Select]
// Okay, let's go for it memcached! and see if that fixes it. If so, look to see which mod tried to access it the first time around.

Easy to undo if it doesn't help.

clearstatcache() is called  automatically when unlink() is used to delete a file. So that that's probably not the problem

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #11 on: April 26, 2013, 02:59:38 PM »
It's a start. What does it hurt to try?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #12 on: April 26, 2013, 03:04:37 PM »
The fact that you can't actually put it in and see if it fixes it. It isn't a consistent and repeatable error. You'd need to put it in and leave it for weeks if not months.

And it might not even repeat in that time, even if you hadn't put that statement in.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #13 on: April 26, 2013, 03:21:01 PM »
All the better if you never see it again. That's the ultimate goal, is it not?

Otherwise you'd just keep theorizing for months before doing anything. What good does that do?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #14 on: April 26, 2013, 03:22:11 PM »
You're missing the point.

You won't know if you fixed it or not.

EDIT: Consider the logic.

An error that occurs once and doesn't happen again. You then make some code changes.

Is the error gone because you made code changes, or because it didn't happen again anyway?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #15 on: April 26, 2013, 03:33:40 PM »
In such cases I put some status checking code in strategic places and write its output to a log file. No matter when it happens, the abnormal behavior usually gets caught close enough to its source for me to figure out its location. But if the OP could do that, we wouldn't be looking at this thread. So the next best thing is to see if there's a likely candidate for failure, which you've identified already, and to try to neutralize it. How else would you know where to look? By tracing the code?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #16 on: April 26, 2013, 03:37:41 PM »
-sigh- You do as you please. I personally don't want to waste my time on such a wild good chase.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #17 on: April 26, 2013, 03:42:25 PM »
I thought the idea was to help the OP, not you or me.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #18 on: April 26, 2013, 03:44:59 PM »
I thought the idea was to collectively share wisdom about the OP's problem. I have already explained why any testing you do on this is largely futile unless you have the situation where the problem recurs regularly in the first place.

Like I said, putting in a piece of code that 'fixes' a problem that wasn't occurring anyway is no proof that you fixed the problem.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #19 on: April 26, 2013, 03:50:27 PM »
And while I don't understand why you want me keep stating the obvious, if the problem occurs again after putting in the code, you will at least know where NOT to look. And it's doing more than sitting on your hands and discussing.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #20 on: April 26, 2013, 03:54:44 PM »
You're still missing the point. You could let it run for 3 months and not see the error again. After that time would you proclaim it fixed?

The problem is that in 3 months, you might not see the error again *legitimately*. How long do you let it run for to test it? A month? Three months? Six? A year?

I have been running multiple 2.0 installations on my VPS for some years now and I have *never* seen this error on mine. I'm not denying it happens, but absence of an error is not proof of fixed, not when the error is so intermittent and sporadic.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #21 on: April 26, 2013, 04:30:49 PM »
Fine. Do nothing.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #22 on: April 26, 2013, 06:37:59 PM »
What should I do, though? I can't reproduce the bug myself. I've never seen it myself. For me, doing the change would make zero difference since I cannot prove I have dealt with it!

So, I will say it again. If a user is seeing it regularly and consistently, then yes, it's worth doing to see if it makes a difference. But users who *don't* see it can't use it because there's no way to know if it actually solves the problem.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #23 on: April 26, 2013, 07:21:46 PM »
Of the listed mods, are there any that you don't have?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #24 on: April 26, 2013, 07:24:56 PM »
Not relevant. There have been other cases documented where those mods are not installed (but still not consistently enough to be reproducible)
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #25 on: April 26, 2013, 07:53:18 PM »
Clean installs with no mods or new themes, too?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #26 on: April 26, 2013, 07:54:56 PM »
That's just it, from all the reports there is nothing in common between them other than the fact they're all errors in the caching system where a file passes the existence test and fails inclusion a statement or so later.

And it's hard to prove you fixed something when you don't have proof it's even happening to start with.


EDIT: This isn't the first time we've had such a bug. But then when it happened, for those it affected, it affected quite regularly. We could put code in to deal with it and know that sooner or later it *would* strike again. This, we can't do so.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #27 on: April 26, 2013, 08:23:02 PM »
Please tell me this happens only on servers with modsecurity.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,858
    • StoryBB/StoryBB on GitHub
Re: Getting random error messages on my forum
« Reply #28 on: April 26, 2013, 08:26:49 PM »
It's happened on servers with and without mod_security activated. Any other ideas? Not that mod_security would actually make any difference in this situation given what mod_security does and exactly how and where it operates.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,573
  • Gender: Male
    • Kindred-999 on GitHub
Re: Getting random error messages on my forum
« Reply #29 on: April 26, 2013, 08:34:33 PM »
and I'll note... I have been running SMF on one or more sites for 9 years, non-stop and I have never seen this error.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Vector’s Shadow

  • Jr. Member
  • **
  • Posts: 218
  • Gender: Male
Re: Getting random error messages on my forum
« Reply #30 on: April 26, 2013, 08:49:57 PM »
Well, my general thinking right now is that you need to be running 2 instances, and in one of them you need to be on line 2658-ish while in the other just jumping into 2715. If write fails, the file would be removed by one instance and attempted to be read by the other. A rare occasion.*

Edit. *This might not be accurate. I'll check it later again when I have a little more time.

MrPhil

  • Guest
Re: Getting random error messages on my forum
« Reply #31 on: April 26, 2013, 09:29:31 PM »
I could well believe that there is a race condition here. I documented one years ago that causes Settings.php to be emptied out (and nothing has been done about it). If a particular file is written/erased in one section of code, and another section checks for that file's existence and a statement or two later (non-atomic) tries to read it, it's certain that sooner or later an erase will slip in between the check and the read. If you've got many, many simultaneous users of a given forum, the odds become rather good that something like this will happen from time to time.

Offline Mikeric

  • Semi-Newbie
  • *
  • Posts: 70
Re: Getting random error messages on my forum
« Reply #32 on: April 30, 2013, 11:04:15 PM »
I hadn't made any changes yet, but It seems to have stopped coming up. the site is new and not busy at all. I asked a few members and I am going to keep an eye on it.

kat

  • Guest
Re: Getting random error messages on my forum
« Reply #33 on: May 09, 2013, 04:30:40 PM »
Everything OK, still?