This is a problem I've been chasing for a week now. It is triggered
by swapping ruby 1.9 for ruby 1.8. The "FAILSAFE" error comes from
rack 1.0.0, rack 0.9.1 gave a different message but failed
nonetheless.
I've been working with the ruby folks, see ruby-lang issue 1414 (my
naive assumption on where the problem originates). My own
investigation has been hampered by the lack of ruby-debug support for
ruby 1.9 combined with the absence of the problem when using ruby 1.8.
However, I just received this message - it may shed some light for
someone familiar with the rack code:
-------------------------
Although I don't know what ActionController::UploadedStringIO
is, I suspect it may be relevant that StringIO#path is no
longer defined.
--
Nobu Nakada
-------------------------
This email came in response to the rack 0.9.1 log messages which read:
-------------------------
NameError (undefined method `path' for class
`ActionController::UploadedStringIO'):
<internal:prelude>:8:in `synchronize'
thin (1.0.0) lib/thin/connection.rb:63:in `pre_process'
thin (1.0.0) lib/thin/connection.rb:54:in `process'
thin (1.0.0) lib/thin/connection.rb:39:in `receive_data'
eventmachine (0.12.6) lib/eventmachine.rb:240:in `run_machine'
eventmachine (0.12.6) lib/eventmachine.rb:240:in `run'
thin (1.0.0) lib/thin/backends/base.rb:57:in `start'
thin (1.0.0) lib/thin/server.rb:150:in `start'
-------------------------
The rack 1.0.0 log messages for the same attempted upload read:
-------------------------
/!\ FAILSAFE /!\ 2009-05-01 10:05:18 -1000
Status: 500 Internal Server Error
invalid byte sequence in US-ASCII
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/utils.rb:
324:in `=~'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/utils.rb:
324:in `block in parse_multipart'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/utils.rb:
319:in `loop'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/utils.rb:
319:in `parse_multipart'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/request.rb:
141:in `POST'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/
methodoverride.rb:15:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/params_parser.rb:15:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/rewindable_input.rb:25:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/session/cookie_store.rb:93:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/reloader.rb:9:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/failsafe.rb:11:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/lock.rb:
11:in `block in call'
<internal:prelude>:8:in `synchronize'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/lock.rb:
11:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/
action_controller/dispatcher.rb:106:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/rack/
static.rb:31:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/urlmap.rb:
46:in `block in call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/urlmap.rb:
40:in `each'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/urlmap.rb:
40:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails/rack/
log_tailer.rb:17:in `call'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/
connection.rb:63:in `pre_process'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/
connection.rb:54:in `process'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/
connection.rb:39:in `receive_data'
/opt/RoR/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.6/lib/
eventmachine.rb:240:in `run_machine'
/opt/RoR/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.6/lib/
eventmachine.rb:240:in `run'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/backends/
base.rb:57:in `start'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/server.rb:
150:in `start'
/opt/RoR/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/rack/handler/
thin.rb:14:in `run'
/opt/RoR/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/
server.rb:111:in `<top (required)>'
script/server:3:in `require'
script/server:3:in `<main>'
-------------------------
Here is the page that triggers the error (on clicking create):
-------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Users: new</title>
<link href="/stylesheets/scaffold.css?1240786686" media="screen"
rel="stylesheet" type="text/css" />
</head>
<body>
<form action="/mugshots" enctype="multipart/form-data"
method="post"><div style="margin:0;padding:0"><input
name="authenticity_token" type="hidden"
value="EL9no9L6TBkwWbc70x3ytHgv3zlzffVU3+oMm/nW3CI=" /></div><p>
<label for="mugshot_uploaded_datal">Upload A Mugshot:</label>
<input id="mugshot_uploaded_data" name="mugshot[uploaded_data]"
size="30" type="file" />
</p>
<p>
<input name="commit" type="submit" value="Create" />
</p>
</form>
</body>
</html>
-------------------------
Needless to say, this page passes W3 Markup Validation with full
green, not even a warning.
One thing I notice here that I don't understand is that the html
source (and w3) clearly identify the page as being of:
<meta http-equiv="content-type" content="text/
html;charset=UTF-8" />
However, the error message in the log tells me:
/!\ FAILSAFE /!\ 2009-05-01 10:05:18 -1000
Status: 500 Internal Server Error
invalid byte sequence in US-ASCII