Getting lots of application errors

Discussion in 'Ruby/Rails' started by djsodom, Sep 7, 2006.

  1. djsodom

    djsodom New Member

    Hi,

    I've got a fresh install. I keep getting 500 errors
    Everything runs fine under WEBrick.

    Using LS, these mysql connection errors keep popping up in my log:

    I also have noticed when I using AJAX on a form and trace it using firebug, nothing shows up as a response.

    Any ideas?

    Thanks,

    Steve
  2. djsodom

    djsodom New Member

    I forgot to note too that I changed ownership of myrailsapp directory to a non-root user as I read to try in another post.
  3. mistwang

    mistwang LiteSpeed Staff

    Please try run WEBrick under the same user of the owner of myrailsapp directory. Make sure it works properly.
    Check if process limit and memory limit is large enough for your application under "Rails" tab. change them to a large number.
  4. djsodom

    djsodom New Member

    changed to the same user of the myrailsapp directory. turned on webrick. everything works fine.

    Here is info from my Rails tab:
    thanks,

    Steve
  5. mistwang

    mistwang LiteSpeed Staff

    Configuration looks fine.
    public/ folder is owned by the same of the myrailsapp directory, right? "ps -ef | grep ruby" should show that ruby is started by the same user.

    Looks like you need to trace ruby process in order to find out what is wrong. do "strace -p <pid_of_child_ruby_process>", there should be two ruby processes, trace the child process. send a test request and check the output.
    You can do the same to the WEBrick process, and compare the strace output.
  6. djsodom

    djsodom New Member

    I have two users steveodom (with is root) and steve. My railsapp folder and its public were previously owned by steveodom. I changed it to steve after having difficulty. Here are my processes:

    PHP:
    steve-odoms-computer:/usr/local steveodomps auxww grep rubysteveodo 23896   0.0  1.8    46932  18232  ??  SNs   4:04PM   0:01.21 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
    steve    23897   0.0  2.0    49036  21008  
    ??  SNs   4:04PM   0:01.42 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
    steveodo 23905   0.0  0.0    27356    424  p1  R
    +    4:04PM   0:00.00 grep ruby
    steve
    -odoms-computer:/usr/local steveodom$
    So right now, it looks like ruby is started by a different user than myrailsapp owner. Dumb question - how do I start ruby with a different user?


    From my ps list above, which is my child_ruby_process?
  7. mistwang

    mistwang LiteSpeed Staff

    By changing the owner of public/ folder.

    None, you need do "killall ruby", then send a request again. you should see two ruby processes, the process with larger pid is the child process, if there is only one, then the child process probably dead due to the error.
  8. djsodom

    djsodom New Member

    Okay, still working on this problem.

    I'm on a intel mac and don't have the strace command available. I tried ktrace, but will have to do some research to get it working.

    One thing I noticed is more RailsRunner.rb process get started with each error I have. For example...

    Then I have click on my site some more, I get more RailsRunner.rb's...
    Does this point to anything?
  9. mistwang

    mistwang LiteSpeed Staff

  10. djsodom

    djsodom New Member

    I tried the fix, but still getting the same errors. On some clicks it works. Other times no. It seems to be worse when I have some dhtml/ajax call that hits the database and replaces something in a div.

    PHP:
    Rendering /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.rhtml (500 Internal Error)
    Mysql::ErrorLost connection to MySQL server during queryUPDATE sessions SET `data` = 'BAh7CjoNd29ya2Jvb2tvOg1Xb3JrQm9vaws6CkBnYW1lIhYwOTA4MDYxNTU2\nMjU4Mzg1MjoLQGl0ZW1zWw1pSmkRaUxpKGlLaSZpHmknOgtAdG90YWxpCjoL\nQHNjb3JlaQg6EEBjdXJhdG9yX2lkaQA6CUB0aWQiBjg6C2xvY2FsZSIKZW4t\nVVM6DnJldHVybl90byIRL3F1ZXN0aW9ucy8xOgl1c2VyaQYiCmZsYXNoSUM6\nJ0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2Vk\newA=\n', `session_id` = '4ce5990a83a21877dd96e8f356d02450', `updated_at` = '2006-09-08 15:58:34' WHERE id 1216
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:122:in `log'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:187:in 
    `execute'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:202:in `update'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/base.rb:1767:in `update_without_lock'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:43:in 
    `update_without_callbacks'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/callbacks.rb:267:in `update_without_timestamps'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/timestamp.rb:48:in `update'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/base.rb:1760:in 
    `create_or_update_without_callbacks'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/callbacks.rb:242:in `create_or_update'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/base.rb:1523:in `save_without_validation'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/validations.rb:744:in 
    `save_without_transactions'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/transactions.rb:120:in `save'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/transactions.rb:86:in 
    `transaction'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/transactions.rb:112:in `transaction'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/transactions.rb:120:in `save'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:307:in 
    `update'
    /srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/base.rb:857:in `silence'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:307:in `update'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb:314:in 
    `close'
    /usr/local/lib/ruby/1.8/cgi/session.rb:330:in `close'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/base.rb:1061:in `close_session'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/base.rb:1103:in 
    `process_cleanup_without_flash'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/flash.rb:145:in `process_cleanup_without_filters'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:434:in `process_cleanup_without_session_management_support'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:123:in 
    `process_cleanup_without_components'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/components.rb:176:in `process_cleanup'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/base.rb:414:in `process_without_filters'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:372:in 
    `process_without_session_management_support'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
    /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/base.rb:321:in `process'
    /srv/www/collectica/config/../vendor/rails/railties/lib/dispatcher.rb:41:in 
    `dispatch'
    /usr/local/lsws/fcgi-bin/RailsRunner.rb:11
    Plus, more RailsRunner.rb processes are started as I click through my app...

    I can run ktrace and post the kdump file here if that would help. Or what else can I try?

    Steve


  11. mistwang

    mistwang LiteSpeed Staff

    The other user confirmed that the new RailsRunner.rb fixed the problem.

    Have you restart LSWS after the change? or do "killall ruby" to make sure the new RailsRunner.rb has been picked up?
  12. djsodom

    djsodom New Member

    I did restart though I've noticed the problem using webrick too. If I click around long enough it using webrick the problem will occur. Not as frequently, but it will happen in that environment as well. That opens up the scope for me and indicates its not a lsws problem. Thanks for your help.

Share This Page