Welcome Guest, Not a member yet? Register   Sign In
random 404s
#1

[eluser]Bas78[/eluser]
Hi, I got something weird going on.

Sometimes when I go to my application using domain.com/myapp or myapp/index.php,
I get a 404 error. I can refresh 20 times and get the same error, but then 10 seconds later I refresh and the application works.

It seems to be occurring completely at random.

The application logs shows this:

On success:
Code:
DEBUG - 2009-11-24 13:57:53 --> Config Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Hooks Class Initialized
DEBUG - 2009-11-24 13:57:53 --> URI Class Initialized
DEBUG - 2009-11-24 13:57:53 --> No URI present. Default controller set.
DEBUG - 2009-11-24 13:57:53 --> Router Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Output Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Input Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Global POST and COOKIE data sanitized
DEBUG - 2009-11-24 13:57:53 --> Language Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Loader Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Helper loaded: url_helper
DEBUG - 2009-11-24 13:57:53 --> Database Driver Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Controller Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Helper loaded: form_helper
DEBUG - 2009-11-24 13:57:53 --> Form Validation Class Initialized
DEBUG - 2009-11-24 13:57:53 --> Parser class already loaded. Second attempt ignored.
DEBUG - 2009-11-24 13:57:53 --> File loaded: /data/www/mainserver/htdocs/myapp/system/application/views/newsview.php
DEBUG - 2009-11-24 13:57:53 --> File loaded: /data/www/mainserver/htdocs/myapp/system/application/views/loginview.php
DEBUG - 2009-11-24 13:57:53 --> File loaded: /data/www/mainserver/htdocs/myapp/system/application/views/logintemplate.php
DEBUG - 2009-11-24 13:57:53 --> Final output sent to browser
DEBUG - 2009-11-24 13:57:53 --> Total execution time: 0.1859

On failure:
Code:
DEBUG - 2009-11-24 07:58:14 --> Config Class Initialized
DEBUG - 2009-11-24 07:58:14 --> Hooks Class Initialized
DEBUG - 2009-11-24 07:58:14 --> URI Class Initialized
ERROR - 2009-11-24 07:58:14 --> 404 Page Not Found --> images

Ignore the timestamps jumping 6 hours in the past, that's a weird timezone problem on the server here, and not correlating to the random error anyway.

The images page that it reports as not found is a map in /system/application and is referenced in my css (in /system/application.css) and in my logintemplate view. According to the log files above it doesn't come near loading any of these files when the error occurs.

Also, after logging in to the application the error is gone. I'm using PHP sessions for this.

I really don't understand what's happening. One moment all's working fine, next it doesn't work.
Anyone got an idea what could cause this?
#2

[eluser]Ben Edmunds[/eluser]
It "sounds" like a hosting problem.


Usually with connectivity jumping in and out it's the hosting...
#3

[eluser]Bas78[/eluser]
Hosting is internal on the department. My other non-CI apps have had no problems whatsoever over the past years.
I can have two browser windows open, say 1 firefox and 1 IE so different sessions, and have the application working in 1 browser and no problems, and getting the 404 on the other.

Today I saw in the logfile that on another 404 it couldn't find css instead of images. This seems to indicate something in my logintemplate since it's the only place where both css and images are present.

part of logintemplate:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/transitional.dtd">
&lt;html&gt;
&lt;head&gt;
    &lt;link rel="icon" href="&lt;?php print base_url(); ?&gt;system/application/images/favicon2.ico" type="image/x-icon"&gt;
    &lt;link rel="shortcut icon" href="&lt;?php print base_url(); ?&gt;system/application/images/favicon2.ico" type="image/x-icon"&gt;
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php print base_url(); ?&gt;system/application/css/styles.css"&gt;
    &lt;link rel="stylesheet" type="text/css" href="&lt;?php print base_url(); ?&gt;system/application/css/csshorizontalmenu.css" /&gt;
    
    &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /&gt;
    
    [removed][removed]
    [removed][removed]
    
    &lt;title&gt;Project Name - &lt;?php print $title; ?&gt;&lt;/title&gt;
&lt;/head&gt;
#4

[eluser]Ben Edmunds[/eluser]
It's odd that you have your images and css under application.

Are you using .htaccess?

What is your base_url setting in config.php?
#5

[eluser]Jeroen Brussich[/eluser]
Move your css and images outside your application and use the Asset Helper?

Should be done in under 15 minutes and then look at the logs again?
#6

[eluser]Bas78[/eluser]
base url must be correct because it works between the times it doesn't work.

Using asset helper, moved css, js, images folders to where it expects stuff to be.
.htaccess file exists but is completely commented out (I stopped experimenting with it until my app is about done).

Still the same error.
Apache access log only says
Code:
GET /~bas/myproject/ HTTP/1.1" 404 539
on an error. So it's not even trying to load images yet.

I now think it is something with the server as I realized it is only happening on the production server and not on the development server. Some messages about broken pipes also in the apache error log. I'll let the sysadmin look into it.

Anyway, thanks for the replies. If it turns out to be CI related, I'll post it here.
#7

[eluser]mct[/eluser]
Yo, I'm getting this too. I just migrated a couple of CI code-bases to a new server, and now I'm seeing the following weirdo behavior:

- When I hit the homepage of a CI site (http://chromebags.collectively.us for example), I get one of the following results, seemingly at random: a "404 Page Not Found", an unformatted "The URI you submitted has disallowed characters: " (that's it; no characters after the colon), or the site itself, fully loaded.

- When I hit any other page (http://chromebags.collectively.us/produc...s/show/14/), I get consistent, successful page loads.

I've tried setting uri_protocol to everything conceivable. I've tried messing with .htaccess.

Trying to think of what has changed since I moved the site. PHP version? Vhost config? How would those affect the homepage loading of CI?
#8

[eluser]mct[/eluser]
Huh. Guess I didn't try everything. Just set uri_protocol to query_string and that made the homepage work consistently. But it wrecks all of my other links, so it's not a solution.

Edit: OK SO: in CI 1.7.1, changing the uri_protocol to REQUEST_URI works. But this was not available in 1.3.3. Guess I'm upgrading.

Hope this nonsense helps someone somewhere sometime.




Theme © iAndrew 2016 - Forum software by © MyBB