Strange mysql/webrick issue with rails 3.2.8 and ruby 1.8.7

got a strange issue on my development local machine, webrick idle
http://0.0.0.0:3000 at …/statuses url link of rails welcome aboard
page,
and I can’t see rails logo, seems a mysql2 connection fault, from my
local
machine I hit a remote mysql database, but I verified mysql remote
access
to my remote server, it’s ok, verified socket, ok, no firewall blocks,
etc.

and when I try to close webrick can’t shutdown with ctrl-C, I have to
hit
ctrl-C and ctrl-Z to shutdown correctly.

OS independent, same issue, same setup - Aptana Studio 3, rails 3.2.8,
ruby
1.8.7 - on CentOS 6.5 and Ubuntu 12.04

BUT
NO ISSUE with a different setup - rails 3.2.8 and ruby 1.9.2 (or 2.x) -

what’s up?

I need my project working with ruby 1.8.7 because of phusion passenger
dependencies on my RHEL server

On 26 February 2014 16:34, Azroth [email protected] wrote:

1.8.7 - on CentOS 6.5 and Ubuntu 12.04

BUT
NO ISSUE with a different setup - rails 3.2.8 and ruby 1.9.2 (or 2.x) -

I think you need to give us some clues. I don’t understand what you
mean by ‘can’t see rails logo’. Are there any errors in the server
terminal window or the rails log?

Colin

Hi Colin

rails server

=> Booting WEBrick
=> Rails 3.2.8 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-02-27 03:37:20] INFO WEBrick 1.3.1
[2014-02-27 03:37:20] INFO ruby 1.8.7 (2011-06-30) [i686-linux]
[2014-02-27 03:37:25] INFO WEBrick::HTTPServer#start: pid=12143
port=3000

development.log is

Started GET “/assets/rails.png” for 127.0.0.1 at Thu Feb 27 03:44:29
+0100
2014
Connecting to database specified by database.yml

database.yml fragment is

development:
adapter: mysql2
host:
port: 3306
encoding: utf8
reconnect: false
database: rails32801blog_development
pool: 5
username:
password:
socket: /var/lib/mysql/mysql.sock

browser idle at http://0.0.0.0:3000/

can’t see rails logo (can’t load assets) of welcome aboard page

can’t hit url http://0.0.0.0:3000/rails/info/properties

plus - can’t properly shutdown webrick with ctrl-C

setup is ruby 1.8.7 and rails 3.2.8

same app with different setup (ruby 1.9.2 and rails 3.2.8) is fully
working, so I think issue is related to ruby 1.8.7 + rails 3.2.8 setup

Il giorno mercoledì 26 febbraio 2014 21:53:03 UTC+1, Colin L. ha
scritto:

On Thursday, February 27, 2014 3:02:43 AM UTC, Azroth wrote:

username:
password:
socket: /var/lib/mysql/mysql.sock

It would be unusual to provide both a socket and a host. Perhaps the
connection is blocked (firewall etc) and ruby is waiting in vain for the
connection to open?

Fred

On 27 February 2014 03:02, Azroth [email protected] wrote:

[2014-02-27 03:37:25] INFO WEBrick::HTTPServer#start: pid=12143 port=3000

development.log is

Started GET “/assets/rails.png” for 127.0.0.1 at Thu Feb 27 03:44:29 +0100
2014
Connecting to database specified by database.yml

Please don’t top post it makes it difficult to follow the thread, post
your reply inline at appropriate points, thanks.

If there is nothing else after that then I suggest it is hanging
trying to access the mysql server. Have you tried leaving it for some
minutes to see if something eventually times out and gives you some
more clues?
Are there any mysql logs on the server that might be useful?

You said, I think, that it works ok with a later version of ruby.
Perhaps the mysql2 adaptor you are using is ruby version specific.

Colin

Il giorno giovedì 27 febbraio 2014 12:55:50 UTC+1, Frederick C. ha
scritto:

reconnect: false

Fred

Don’t know, Fred, it’s a rebus, I can connect correctly with a different
setup (ruby 1.9.2 + rails 3.2.8), can’t connect with ruby 1.8.7 + rails
3.2.8, so I think it’s not a mysql/firewall misconfiguration, it’s an
issue
related to ruby version

Il giorno giovedì 27 febbraio 2014 09:44:02 UTC+1, Colin L. ha scritto:

=> Call with -d to detach
2014

host:
port: 3306
encoding: utf8
reconnect: false
database: rails32801blog_development
pool: 5
username:
password:
socket: /var/lib/mysql/mysql.sock

waited for some minutes, no way, browser is hanging indefinetely,

mysql error log report

140224 01:19:52 mysqld_safe mysqld from pid file
/var/run/mysqld/mysqld.pid
ended
140224 01:19:53 mysqld_safe Starting mysqld daemon with databases from
/var/lib/mysql
140224 1:19:53 InnoDB: Initializing buffer pool, size = 8.0M
140224 1:19:53 InnoDB: Completed initialization of buffer pool
140224 1:19:53 InnoDB: Started; log sequence number 0 255851
140224 1:19:53 [Note] Event Scheduler: Loaded 0 events
140224 1:19:53 [Note] /usr/libexec/mysqld: ready for connections.
Version: ‘5.1.73’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306
Source
distribution
140224 1:59:26 [Note] /usr/libexec/mysqld: Normal shutdown

so no errors, nothing strange

mysql2 gem version on my local development machine is 0.3.11

On 27 February 2014 18:51, Azroth [email protected] wrote:


mysql2 gem version on my local development machine is 0.3.11

You could try with the latest version of mysql, or drop back to 0.2.
Perhaps there were issues with 0.3.11 and ruby 1.8.7. Possibly a long
shot but worth a try.

Colin

Il giorno giovedì 27 febbraio 2014 21:43:45 UTC+1, Colin L. ha scritto:

Colin

progress, thank you Colin

installed gem mysql2 version 0.2

now I can hit http://0.0.0.0:3000/rails/info/properties

I get an error
ActiveRecord::ConnectionNotEstablished

activerecord gem version is 3.2.8

development.log reports

Started GET “/assets/rails.png” for 127.0.0.1 at Fri Feb 28 18:39:40
+0100
2014
Connecting to database specified by database.yml

ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished):
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in
retrieve_connection' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in retrieve_connection’
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in
connection' activerecord (3.2.8) lib/active_record/query_cache.rb:67:in call’
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in call’
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in
_run__72693120__call__4__callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in send’
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in
__run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:385:in _run_call_callbacks’
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in send' activesupport (3.2.8) lib/active_support/callbacks.rb:81:in run_callbacks’
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in call’
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call’
actionpack (3.2.8)
lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.8) lib/rails/rack/logger.rb:26:in call_app’
railties (3.2.8) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in call’
rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:in call’
activesupport (3.2.8)
lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:in call’
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in
call' railties (3.2.8) lib/rails/engine.rb:479:in call’
railties (3.2.8) lib/rails/application.rb:223:in call' rack (1.4.1) lib/rack/content_length.rb:14:in call’
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in call' rack (1.4.1) lib/rack/handler/webrick.rb:59:in service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
/usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in start’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in start’
/usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:in start’
/usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:in start’
rack (1.4.1) lib/rack/handler/webrick.rb:13:in run' rack (1.4.1) lib/rack/server.rb:265:in start’
railties (3.2.8) lib/rails/commands/server.rb:70:in start' railties (3.2.8) lib/rails/commands.rb:55 railties (3.2.8) lib/rails/commands.rb:50:in tap’
railties (3.2.8) lib/rails/commands.rb:50
script/rails:6:in `require’
script/rails:6

Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.5ms)
Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(1.7ms)
Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (12.5ms)

Started GET “/rails/info/properties” for 127.0.0.1 at Fri Feb 28
18:39:42
+0100 2014

ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished):
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in
retrieve_connection' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in retrieve_connection’
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in
connection' activerecord (3.2.8) lib/active_record/query_cache.rb:67:in call’
activerecord (3.2.8)
lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in call’
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in
_run__72693120__call__4__callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in send’
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in
__run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:385:in _run_call_callbacks’
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in send' activesupport (3.2.8) lib/active_support/callbacks.rb:81:in run_callbacks’
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in call’
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call’
actionpack (3.2.8)
lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.8) lib/rails/rack/logger.rb:26:in call_app’
railties (3.2.8) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in call’
rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:in call’
activesupport (3.2.8)
lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:in call’
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in
call' railties (3.2.8) lib/rails/engine.rb:479:in call’
railties (3.2.8) lib/rails/application.rb:223:in call' rack (1.4.1) lib/rack/content_length.rb:14:in call’
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in call' rack (1.4.1) lib/rack/handler/webrick.rb:59:in service’
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
/usr/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in start’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in start’
/usr/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/lib/ruby/1.8/webrick/server.rb:92:in start’
/usr/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/lib/ruby/1.8/webrick/server.rb:82:in start’
rack (1.4.1) lib/rack/handler/webrick.rb:13:in run' rack (1.4.1) lib/rack/server.rb:265:in start’
railties (3.2.8) lib/rails/commands/server.rb:70:in start' railties (3.2.8) lib/rails/commands.rb:55 railties (3.2.8) lib/rails/commands.rb:50:in tap’
railties (3.2.8) lib/rails/commands.rb:50
script/rails:6:in `require’
script/rails:6

Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.5ms)
Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(1.0ms)
Rendered
/var/lib/gems/1.8/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (10.7ms)

It’s been a while since I last struggled with the 1.8.7 / 1.9 ruby
transition with rails 3 and mysql but I’m wondering. Is it possible you
have a version issue in the ‘gem install…’ sequence that’s causing
your
rails app not to connect to mysql?