500 Internal Server Error
I'm using a periodically_call_remote function in Rails 2.1 which uses RJS to create an AJAX call on a certain ruby function on a certain time.

The error occurs on production state when the function is being called and results to "500 Internal Server Error". Upon looking the log file this is what it shows:

/!\ FAILSAFE /!\  Tue Feb 07 20:58:45 -0500 2012
  Status: 500 Internal Server Error
  can't modify frozen string Caused by an RJS

Upon searching the net, the error seems to be a bug on CGI and so by shifting from CGI to FCGI on the .htaccess file, solved the problem.


Just edit the following lines on the said file:

1) Comment out the FCGI handler

# General Apache options
#AddHandler fastcgi-script .fcgi

and

2) Change rewrite to fcgi (originally cgi)

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Note that the function periodically_call_remote is already obsolete on latest release of Rails. That means that this solution is used mainly on old version of Rails application. By now, a pure AJAX call is used for such methods.

1 comment :

  1. Another useful post.  Thanks for sharing! :)

    Neteffects- Computer Network Specialist

    ReplyDelete