Getting lots of application errors

djsodom

Active Member
#1
Hi,

I've got a fresh install. I keep getting 500 errors
Application error (Apache)

Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html
Everything runs fine under WEBrick.

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

Rendering /srv/www/collectica/config/../vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.rhtml (500 Internal Error)
Mysql::Error: Lost connection to MySQL server during query: UPDATE sessions SET `data` = 'BAh7CjoNd29ya2Jvb2tvOg1Xb3JrQm9vaws6C0BzY29yZWkAOhBAY3VyYXRv\ncl9pZGkAOgtAaXRlbXNbCWkbaR1pHGkeOglAdGlkIgcxNDoLQHRvdGFsaQk6\nCkBnYW1lIhcwOTA3MDYxNDI2MTA5Mzg4MTE6C2xvY2FsZSIKZW4tVVM6DnJl\ndHVybl90byIRL3F1ZXN0aW9ucy8xIgpmbGFzaElDOidBY3Rpb25Db250cm9s\nbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsAOgl1c2VyaQY=\n', `session_id` = '4ce5990a83a21877dd96e8f356d02450', `updated_at` = '2006-09-07 14:31:26' WHERE id = 1216
/srv/www/collectica/config/../vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:122:in `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
 

djsodom

Active Member
#2
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.
 

mistwang

LiteSpeed Staff
#3
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.
 

djsodom

Active Member
#4
changed to the same user of the myrailsapp directory. turned on webrick. everything works fine.

Here is info from my Rails tab:
Ruby Path /usr/local/bin/ruby
Rails Environment Development
Max Connections 5
Environment LSAPI_MAX_REQS=1000
LSAPI_MAX_IDLE=60
Initial Request Timeout (secs) 60
Retry Timeout (secs) 0
Connection Keepalive Timeout 60
Response Bufferring No
Back Log 50
Run On Start Up Yes
Max Idle Time 300
Priority 3
Memory Soft Limit (bytes) 150M
Memory Hard Limit (bytes) 200M
Process Soft Limit 100
Process Hard Limit 100
thanks,

Steve
 

mistwang

LiteSpeed Staff
#5
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.
 

djsodom

Active Member
#6
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.
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 steveodom$ ps 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?


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.
From my ps list above, which is my child_ruby_process?
 

mistwang

LiteSpeed Staff
#7
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?
By changing the owner of public/ folder.

From my ps list above, which is my child_ruby_process?
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.
 

djsodom

Active Member
#8
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...

steve-odoms-computer:/srv/www/collectica steveodom$ ps auxww | grep ruby
steveodo 12342 0.0 1.8 46932 18220 ?? SNs 10:52AM 0:01.78 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 12343 0.0 0.3 49036 3144 ?? SNs 10:52AM 0:02.21 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 13136 0.0 0.3 49036 3068 ?? SNs 11:07AM 0:01.61 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 13467 0.0 0.0 27356 424 p1 S+ 11:14AM 0:00.00 grep ruby
Then I have click on my site some more, I get more RailsRunner.rb's...
steve-odoms-computer:/srv/www/collectica steveodom$ ps auxww | grep ruby
steveodo 13495 0.8 2.0 48700 20208 ?? SN 11:14AM 0:00.43 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 13500 0.8 2.0 48700 20204 ?? SN 11:14AM 0:00.41 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 12342 0.0 1.8 46932 18220 ?? SNs 10:52AM 0:01.80 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 12343 0.0 0.3 49036 3144 ?? SNs 10:52AM 0:02.24 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 13136 0.0 0.3 49036 3048 ?? SNs 11:07AM 0:01.63 ruby /usr/local/lsws/fcgi-bin/RailsRunner.rb
steveodo 13502 0.0 0.0 27712 268 p1 R+ 11:14AM 0:00.00 grep ruby
steve-odoms-computer:/srv/www/collectica steveodom$
Does this point to anything?
 

djsodom

Active Member
#10
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::Error: Lost connection to MySQL server during query: UPDATE 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


I figured it is the same problem as yours.
http://www.litespeedtech.com/support/forum/showthread.php?p=2727

Please try the fix I came up with and let me know the result.
Thanks!
 

mistwang

LiteSpeed Staff
#11
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?
 

djsodom

Active Member
#12
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.
 
Top