MySQL losts connection, can't refer to User


#1

Hi

Another problem here. After the upgrade to 1.1 both rails and engines,

my app on windows crashes very often on requests. It can’t refer to User
model or losts connection to mysql. It appears like 2-3 times per 10
requests.

Eg.

Mysql::Error: Lost connection to MySQL server during query: UPDATE
sessions SET data =
'BAh7CiINcHJldl91cmkiHS9jYXNlcy9nZXRfY2FzZXM/d2hpY2g9MzoNbGFu\nZ3VhZ2UiCnBsLVBMIg5yZXR1cm4tdG8wOgl1c2VybzoJVXNlcgo6HEBuZXdf\ncmVjb3JkX2JlZm9yZV9zYXZlMDoQQGF0dHJpYnV0ZXN7GiIJc2FsdCItZmVm\nNmNlNTQ5NDg3OGI4NDRjYTQxYzRiNGNkODFmMGI4NzFkMjkwZiIRZGVsZXRl\nX2FmdGVyMCIPdXBkYXRlZF9hdHU6CVRpbWUNq4sagBi6CiUiD2FjY291bnRf\naWQwIhNzZWN1cml0eV90b2tlbiItOWMyNjEwODhhMGQ0Y2U4MTcyMjI1MDNi\nZjQ5OWMzMTA2Yzc4N2E3ZSIJcm9sZTAiDWxhc3RuYW1lIg5HcmFib3dza2ki\nDmZpcnN0bmFtZSILUmFmYcWCIgdpZCIGMSIQZGVzY3JpcHRpb24iACIKcGhv\nbmUiDjYwMzExMDY1NCIMZGVsZXRlZCIGMCIRdG9rZW5fZXhwaXJ5IhgyMDA2\nLTAyLTA1IDE5OjU1OjA5Ig12ZXJpZmllZCIGMSINcG9zaXRpb24iF0lUIFNl\ncml2Y2UgTWFuYWdlciIOcGFyZW50X2lkMCIRbG9nZ2VkX2luX2F0dTsKDauL\nGoAYugolIhRzYWx0ZWRfcGFzc3dvcmQiLWI3ZjcxNTk5ZWQ1MGFlMzdjNDcx\nMzZmMWMzNWEyZTYyZDQyYWMwNWYiCmxvZ2luIg9yZ3JhYm93c2tpIg9jcmVh\ndGVkX2F0IhgyMDA2LTAxLTI4IDIyOjQwOjExIgplbWFpbCIacmdyYWJvd3Nr\naUBleG9yaWdvLnBsOhJAbmV3X3Bhc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dGl2ZVJlY29yZDo6RXJyb3JzBzoKQGJhc2VACjsi
ewAi\nCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7\nAAY6CkB1c2VkewA=\n’,

session_id = ‘70cc8a35f2b959ac7b6a037fc52b5ed3’, updated_at =
‘2006-03-29 13:22:09’ WHERE id = 965
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/abstract_adapter.rb:120:in

`log’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/mysql_adapter.rb:185:in

`execute’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/mysql_adapter.rb:200:in

`update’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1717:in

`update_without_lock’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/locking.rb:33:in

`update_without_callbacks’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:274:in

`update_without_timestamps’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/timestamp.rb:39:in

`update’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1712:in

`create_or_update_without_callbacks’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:249:in

`create_or_update’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1388:in

`save_without_validation’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/validations.rb:724:in

`save_without_transactions’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in

`save’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in

`transaction’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:91:in

`transaction’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:118:in

`transaction’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in

`save’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:307:in

`update’
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:794:in

`silence’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:307:in

`update’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:314:in

close' C:/ruby/lib/ruby/1.8/cgi/session.rb:330:inclose’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:982:in

`close_session’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:1024:in

`process_cleanup_without_flash’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/flash.rb:147:in

`process_cleanup_without_filters’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:426:in

`process_cleanup_without_session_management_support’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:126:in

`process_cleanup_without_components’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/components.rb:182:in

`process_cleanup’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:383:in

`process_without_filters’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:364:in

`process_without_session_management_support’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:117:in

process' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:38:indispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:115:in
handle_dispatch' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:81:inservice’ C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' C:/ruby/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:92:instart’
C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' C:/ruby/lib/ruby/1.8/webrick/server.rb:82:instart’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:67:in
`dispatch’
C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/servers/webrick.rb:59

C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in

require' C:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/server.rb:30 C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in

`require’ ./script/server:3 -e:3


#2

It looks like you may have a conflict with transaction-simple. If you
have that gem installed, try uninstalling it. transaction-simple was
upgraded to the current version in Rails 1.1, though it doesn’t
include the whole library. In any case, that’s where I’d look.

-Tom


#3

Tom W. napisaÅ?(a):

It looks like you may have a conflict with transaction-simple. If you
have that gem installed, try uninstalling it. transaction-simple was
upgraded to the current version in Rails 1.1, though it doesn’t
include the whole library. In any case, that’s where I’d look.

-Tom

Hmm, I have reinstalled whole ruby + rails to 1.8.4 and 1.1, don’t have
any other gems installed. Could it be a problem with Windows platform
incompatibility?


#4

Piotr U. wrote:

Tom W. napisaÅ?(a):

It looks like you may have a conflict with transaction-simple. If you
have that gem installed, try uninstalling it. transaction-simple was
upgraded to the current version in Rails 1.1, though it doesn’t
include the whole library. In any case, that’s where I’d look.

-Tom

Hmm, I have reinstalled whole ruby + rails to 1.8.4 and 1.1, don’t have
any other gems installed. Could it be a problem with Windows platform
incompatibility?

I have similar problems. Here is my setup:
+InstantRails 1.3
+RadRails 0.6.2
+Windows 2000 Pro SP4 (With IIS-not running)

When using WEBrick it would crash every 4th or 5th operation. I could
repeat it over and over using the same steps. I switched to using Apache
and InstantRails’ SCGI server. With this setup it crashes much less but
will still crash on occassion. It’s the Windows ruby.exe console window
(running for SCGI) that crashes and must be continually restarted.

I’m not sure where the problem is. I presume it is a newer problem
because when I was using RoR 1.0 (InstantRails 1.0) I never noticed
these crashes. But I was brand new to RoR then too.

I hope there is something that can be done for improved Windows
stability.

-Mark E.


#5

On 4/17/06, Mark E. removed_email_address@domain.invalid wrote:

(running for SCGI) that crashes and must be continually restarted.

I’m not sure where the problem is. I presume it is a newer problem
because when I was using RoR 1.0 (InstantRails 1.0) I never noticed
these crashes. But I was brand new to RoR then too.

I hope there is something that can be done for improved Windows
stability.

-Mark E.

Try deleting the file:

InstantRails\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\mysql.so

This is the native C mysq binding for Ruby. If you delete this, then
Rails will automatically use the pure Ruby driver instead.

There has been a report similar to yours where this solved the
problem. Please let me know if this works.

Curt


#6

Curt H. wrote:

On 4/17/06, Mark E. removed_email_address@domain.invalid wrote:

(running for SCGI) that crashes and must be continually restarted.

I’m not sure where the problem is. I presume it is a newer problem
because when I was using RoR 1.0 (InstantRails 1.0) I never noticed
these crashes. But I was brand new to RoR then too.

I hope there is something that can be done for improved Windows
stability.

-Mark E.

Try deleting the file:

InstantRails\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\mysql.so

[…]
Curt

Curt,

That seemed to fix it! Thanks! I haven’t had a crash since I remove that
file. That makes me feel much better now about future development on
RoR.

Thanks,
-Mark E.