Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X issues (bad environment variable, file descriptor was not passed) #2

Closed
jackdempsey opened this issue Dec 29, 2012 · 10 comments
Closed

Comments

@jackdempsey
Copy link

/Users/jack/.rvm/gems/ruby-1.9.3-p327@app-gemset/gems/spring-0.0.2/lib/spring/application_manager.rb:58:in `[]=': bad environment variable value (ArgumentError)

Originally had it in :development group, now trying at top level in gemfile. Neither seems to work. Have you come across this yourself?

@dhh
Copy link
Member

dhh commented Dec 29, 2012

I have the same problem.

@sobrinho
Copy link
Contributor

Same here but with different exceptions for rspec and console:

time bundle exec spring rspec spec/controllers
You did not specify how you would like Rails to report deprecation notices for your  environment, please set confi
g.active_support.deprecation to :log, :notify or :stderr at config/environments/.rb
/Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/conn
ection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection': database configuration does 
not specify adapter (ActiveRecord::AdapterNotSpecified)
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/activ
e_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/activ
e_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/activ
e_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
time bundle exec spring console
/Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-833a7ef3dca6/lib/spring/ap
plication_manager.rb:58:in `[]=': bad environment variable value (ArgumentError)
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-833a7ef3dca6/
lib/spring/application_manager.rb:58:in `block in start_child'
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-833a7ef3dca6/
lib/spring/application_manager.rb:55:in `fork'
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-833a7ef3dca6/
lib/spring/application_manager.rb:55:in `start_child'
        from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-833a7ef3dca6/
lib/spring/application_manager.rb:17:in `start'

I didn't looked the spring source yet, just reporting that the issue exists :)

ruby 1.9.3-p327 and rails 3.2.9

@sobrinho
Copy link
Contributor

HA!

The problem only happens when spring got called using time, it works without time command.

I'm using the OS X, can be related?

I don't have a linux machine right now to check that.

@jonleighton
Copy link
Member

Right, this may be an OS X issue. I have only been able to test it on Linux so far, so I don't know for sure that it works on OS X yet.

This error looks like an empty string is getting passed as the rails environment for the command. The rails environment to use is determined here:

https://github.com/jonleighton/spring/blob/833a7ef3dca62ab7c96872eb88be5df66a572239/lib/spring.rb#L72-L80

Could somebody please play with the code and work out what's going on? Is one of ENV["RAILS_ENV"] or ENV["RACK_ENV"] returning an empty string? If so, we should be able to fix it by rejecting empty string values.

BTW, spring isn't designed to be run with bundle exec. That should work, but will make it slower. When spring boots your app, it'll put it under bundler.

@sobrinho
Copy link
Contributor

I will try to debug the cause ;)

@sobrinho
Copy link
Contributor

I'm not sure if non-deterministic is the right term but you'll get the idea.

Sometimes the exception is raised and sometimes not, the time command is not related to the problem.

I thought that was but sometimes the spring works using the time and sometimes not, same happens without the time, sometimes works and sometimes not.

The exception is almost the same on every fail:

spring-0.0.2/lib/spring/application.rb:98:in `recv_io': file descriptor was not passed (msg_controllen=0 smaller than sizeof(struct cmsghdr)=12) (SocketError)

Sometimes when I connect to the socket of spring using an irb session, the exception is raised and sometimes not:

# ll tmp/spring/
total 8
drwxr-xr-x  4 sobrinho  staff   136B Dec 29 23:32 .
drwxr-xr-x  7 sobrinho  staff   238B Dec 29 10:23 ..
srwxr-xr-x  1 sobrinho  staff     0B Dec 29 23:32 64265
-rw-r--r--  1 sobrinho  staff     6B Dec 29 23:32 64265.pid

First try:

# irb
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> UNIXSocket.new('tmp/spring/64265')
=> #<UNIXSocket:fd 5>
irb(main):003:0> UNIXSocket.new('tmp/spring/64265')
=> #<UNIXSocket:fd 6>
irb(main):004:0> UNIXSocket.new('tmp/spring/64265')
=> #<UNIXSocket:fd 7>

Second try:

# irb
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> UNIXSocket.new('tmp/spring/64265')
=> #<UNIXSocket:fd 5>
irb(main):003:0> You did not specify how you would like Rails to report deprecation notices for your  environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/.rb

I'm not sure if something should happen just after connecting to the socket, I was thinking that it would wait for a command before doing anything.

Seems like the server is doing something just after connecting and since I didn't send any command yet (that will discover the environment), the problem happens.

I'm not pretty familiar with sockets, I think that's my problem now :(

Anyway, this helps in something?

If you need to run something to trace the problem, tell me :)

@sgruhier
Copy link

same error for me (MAC OSX) with or with ENV["RAILS_ENV"] or ENV["RACK_ENV"]

@jonleighton
Copy link
Member

Thanks guys. Does this branch help at all? https://github.com/jonleighton/spring/tree/fix_fd_not_passed

@sobrinho
Copy link
Contributor

@jonleighton not yet, same error :(

# time bundle exec spring rake -D 
/Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:98:in `recv_io': file descriptor was not passed (msg_controllen=0 smaller than sizeof(struct cmsghdr)=12) (SocketError)
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:98:in `redirect_output'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:64:in `serve'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:53:in `block in run'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:47:in `loop'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:47:in `run'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application.rb:43:in `start'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:59:in `block in start_child'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:55:in `fork'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:55:in `start_child'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:17:in `start'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:36:in `block in run'
    from <internal:prelude>:10:in `synchronize'
    from /Users/sobrinho/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/application_manager.rb:35:in `run'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/server.rb:35:in `serve'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/server.rb:28:in `block in boot'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/server.rb:28:in `loop'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/server.rb:28:in `boot'
    from /Users/sobrinho/Developer/nohup/tributario/vendor/bundle/ruby/1.9.1/bundler/gems/spring-96dce4ce2899/lib/spring/server.rb:9:in `boot'
    from -e:1:in `<main>'

@kbaum
Copy link

kbaum commented Jan 2, 2013

I installed the latest spring from git and i am still getting the following:

/Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:94:in `recv_io': file descriptor was not passed (msg_controllen=0 smaller than sizeof(struct cmsghdr)=12) (SocketError)
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:94:in `redirect_output'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:60:in `serve'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:49:in `block in run'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:47:in `loop'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:47:in `run'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application.rb:43:in `start'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:59:in `block in start_child'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:55:in `fork'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:55:in `start_child'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:17:in `start'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:36:in `block in run'
    from <internal:prelude>:10:in `synchronize'
    from /Users/karl/.rvm/rubies/ruby-1.9.3-p327-falcon/lib/ruby/1.9.1/mutex_m.rb:62:in `mu_synchronize'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/application_manager.rb:35:in `run'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/server.rb:35:in `serve'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/server.rb:28:in `block in boot'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/server.rb:28:in `loop'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/server.rb:28:in `boot'
    from /Users/karl/.rvm/gems/ruby-1.9.3-p327-falcon@viewthespace/bundler/gems/spring-e70356966362/lib/spring/server.rb:9:in `boot'```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants