Hi all,
I’ve been having a lot of trouble with Rails Errors for over I week, and
I finally realized that they are caused by Safari 3.1, since everything
works fine with FireFox… Pretty much every AJAX request makes the fcgi
process crash…
Moreover, I do not use getElementsByClassName (which is known to be
the cause of many problems), rails is up to date, and so is Prototype
(1.6.0.1).
Here is what the log says:
/!\ FAILSAFE /!\ Thu Mar 27 13:47:50 +0100 2008
Status: 500 Internal Server Error
can’t modify frozen string
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:462:in
gsub!' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:462:inclean_up_ajax_request_body!’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:380:in
parse_formatted_request_parameters' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:78:inrequest_parameters’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:287:in
parameters' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:22:inrequest_method’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/request.rb:35:in
method' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/routing.rb:1483:inextract_request_environment’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in
recognize' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:170:inhandle_request’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in
dispatch' /hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:indispatch_cgi’
/hsphere/local/home/cukch/rails/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in
`dispatch’
dispatch.cgi:10
I have no idea what this is caused by. The solution that was recommended
is switching to Mongrel, and of course I would do it if I could… But I
am on a shared host, so it is not possible…
Does anyone has any idea how to solve this? I have tried for over a
week, and nothing helps. I tried switching from fastcgi to plain old
cgi, but the bugs remain the same (but plain old cgi is indeed used, for
the request take a lot longer).
Thank you very much if you can help!
Nauhaie
I tried replacing
vendor/rails/actionpack/lib/action_controller/request.rb:462
def clean_up_ajax_request_body!(body)
body.chop! if body[-1] == 0
body.gsub!(/&_=$/, ‘’)
end
BY
def clean_up_ajax_request_body!(body)
unless body.frozen?
body.chop! if body[-1] == 0
body.gsub!(/&_=$/, ‘’)
end
end
I don’t know if this might cause other kinds of problems, but at least,
it doesn’t crash anymore…
Nauhaie N. wrote:
I tried replacing
vendor/rails/actionpack/lib/action_controller/request.rb:462
def clean_up_ajax_request_body!(body)
body.chop! if body[-1] == 0
body.gsub!(/&_=$/, ‘’)
end
BY
def clean_up_ajax_request_body!(body)
unless body.frozen?
body.chop! if body[-1] == 0
body.gsub!(/&_=$/, ‘’)
end
end
I don’t know if this might cause other kinds of problems, but at least,
it doesn’t crash anymore…
Unfortunately I am in shared hosting, can’t change fast-cgi to mongrel
and can’t hack request.rb.
Looks like I’m snookered until Safari/Fast-CGI/ or rails patches the
bug.
Can anyone think of any other way to work around this? It basically
rules out AJAX from RoR for me which is a major blow!
On 28 Mar 2008, at 23:19, A. james Boswell wrote:
I don’t know if this might cause other kinds of problems, but at
least,
it doesn’t crash anymore…
Unfortunately I am in shared hosting, can’t change fast-cgi to mongrel
and can’t hack request.rb.
You can if you freeze rails into your vendor/rails . IIRC this here is
to work around a bug in some versions of safari where extra stuff
would get appended to the end of ajax requests.
Fred
Frederick C. wrote:
On 28 Mar 2008, at 23:19, A. james Boswell wrote:
I don’t know if this might cause other kinds of problems, but at
least,
it doesn’t crash anymore…
Unfortunately I am in shared hosting, can’t change fast-cgi to mongrel
and can’t hack request.rb.
You can if you freeze rails into your vendor/rails . IIRC this here is
to work around a bug in some versions of safari where extra stuff
would get appended to the end of ajax requests.
Thanks Fred,
So I’m guessing this means cp’ing from the /usr/lib/ tree through to
either my own project or my own gems path. Is this a manual process is
there some rails scripted way to freeze?
Also - if I set my GEMS path correctly, can I move only the relevant
files across?
Frederick C. wrote:
There’s a rake task: rake rails:freeze:gems
It’s an all or nothing thing, you can’t just freeze some gems or some
files
Fred
Thanks so much Fred!
just what I needed to know 
Cheers
AJB
A. james Boswell wrote:
Thanks so much Fred!
just what I needed to know 
Dang! Spoke too soon
Freezing to the gems for Rails 2.0.2
Unpacked gem:
‘/home/familie2/registration/vendor/rails/activesupport-2.0.2’
ERROR: While executing gem … (Gem::Exception)
Cannot load gem at
[/home/familie2/.gems/cache/activerecord-2.0.2.gem] in
/home/familie2/registration/vendor/rails
Do I need to clobber the cache somehow?
On Mar 29, 11:41 pm, “A. james Boswell” <rails-mailing-l…@andreas-
s.net> wrote:
Frederick C. wrote:
Thanks Fred,
So I’m guessing this means cp’ing from the /usr/lib/ tree through to
either my own project or my own gems path. Is this a manual process is
there some rails scripted way to freeze?
Also - if I set my GEMS path correctly, can I move only the relevant
files across?
There’s a rake task: rake rails:freeze:gems
It’s an all or nothing thing, you can’t just freeze some gems or some
files
Fred