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

slavenode.go:215: [test_helper] read unix ->: EOF #617

Closed
typeoneerror opened this issue Jan 7, 2017 · 64 comments
Closed

slavenode.go:215: [test_helper] read unix ->: EOF #617

typeoneerror opened this issue Jan 7, 2017 · 64 comments

Comments

@typeoneerror
Copy link

zeus start produces this error after upgrading to 0.15.12.

slavenode.go:215: [test_helper] read unix ->: EOF
@typeoneerror
Copy link
Author

Went ahead and blasted my gemset and reinstalled all gems and seems to work now. Must've been a temporary fail.

@sideshowcoder
Copy link
Collaborator

Might be a dependency interaction, I had the same some time ago with an earlier version.

@mmcnl
Copy link

mmcnl commented Jan 10, 2017

I'm still experiencing this issue, on both ruby-2.3.3 and 2.4.0.

@sideshowcoder
Copy link
Collaborator

Ugh thats not good have you tried removing and reinstalling the zeus gem?

@sideshowcoder sideshowcoder reopened this Jan 11, 2017
@mmcnl
Copy link

mmcnl commented Jan 11, 2017

Hmm, I could have sworn I tried that but indeed gem uninstall zeus followed by a reinstall has allowed it to work. The previous issue had occurred in multiple ruby envs as well as with the previous version of zeus (I tried installing this in case the current issue was due to a recent regression). I'll let you know if it shows up again. Thanks for the help!

@sideshowcoder
Copy link
Collaborator

Sorry for that I would really like to know what is going on but can't think of a way to debug... Thanks for your quick feedback.

@kenn
Copy link

kenn commented Jan 25, 2017

I'm also seeing this, some time after upgraded to 0.15.13.pre:

slavenode.go:215: [test_environment] read unix ->: EOF
slavenode.go:215: [development_environment] read unix ->: EOF

and remove / reinstall gem does not help, so I'm kinda stuck here. Oddly enough, zeus still works for another project, so there seems to be project-specific persistent state somewhere.

@kenn
Copy link

kenn commented Jan 25, 2017

Oops sorry, it occurred when there's an error in an initializer where ERB evaluation fails due to a stupid syntax error in a yml file.

# config.yml
key: <%= key: value %> # <= syntax error

# syntax error, unexpected tLABEL (SyntaxError)
ERB.new(config.read).result

Sorry for confusion.

@sideshowcoder
Copy link
Collaborator

Yeah I think it's one of the cases for #555 to be honest, it should be clearer in what is actually going wrong...

@blimmer
Copy link

blimmer commented Feb 7, 2017

@kenn how did you identify what file was the problem? I'm getting this same error message but don't know what's wrong

@sideshowcoder
Copy link
Collaborator

@blimmer have you tried to run the command without zeus?

@kenn
Copy link

kenn commented Feb 8, 2017

@blimmer run without zeus, and confirm the issue is not related to zeus. Problems vary, but that's a start 😉

@blimmer
Copy link

blimmer commented Feb 8, 2017

I can run bundle exec rspec and just rspec and my test suite runs with no problems. This issue only occurs when I try to run it with zeus.

zeus test (alias: rspec) [run to see backtrace]
slavenode.go:215: [test_helper] read unix ->: EOF

When I run zeus test in another tab it still just gives me the read unix ->: EOF message.

@blimmer
Copy link

blimmer commented Feb 24, 2017

Does anyone know how to get more information about this error? cc @sideshowcoder

I've finally figured out how to clone this, build the app, but it seems like Go only exposes the err.Error() string, so I can't figure out how to get more information (like a stacktrace) from the error.

I was hoping that a panic could help, but no dice:

panic: read unix ->: EOF

goroutine 22 [running]:
panic(0x412f380, 0xc4204b2050)
        /usr/local/Cellar/go/1.7.5/libexec/src/runtime/panic.go:500 +0x1a1
github.com/burke/zeus/go/processtree.(*SlaveNode).doBootingState(0xc420010380, 0x0, 0x0)
        /usr/local/golang/src/github.com/burke/zeus/go/processtree/slavenode.go:215 +0x413
github.com/burke/zeus/go/processtree.(*SlaveNode).Run(0xc420010380, 0xc420114000)
        /usr/local/golang/src/github.com/burke/zeus/go/processtree/slavenode.go:146 +0x26e
created by github.com/burke/zeus/go/processtree.StartSlaveMonitor.func1
        /usr/local/golang/src/github.com/burke/zeus/go/processtree/slavemonitor.go:53 +0x1cc

It really seems like there has to be a way to get even just a little more information about this issue, but I don't really know any golang 😞

also, this is the log I get if I ask zeus to give me more info:

2017/02/24 15:34:41.478296 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] test_helper/(no PID) entering state SUnbooted
2017/02/24 15:34:41.478566 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] default_bundle/(no PID) entering state SUnbooted
2017/02/24 15:34:41.478620 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] boot/(no PID) entering state SUnbooted
2017/02/24 15:34:41.478635 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] development_environment/(no PID) entering state SUnbooted
2017/02/24 15:34:41.478664 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] prerake/(no PID) entering state SUnbooted
2017/02/24 15:34:41.478717 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] test_environment/(no PID) entering state SUnbooted
2017/02/24 15:34:41.479335 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:380] boot/(no PID) running the root command now
2017/02/24 15:34:41.623468 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] boot/(77840) initialized slave boot with pid 77840 from parent 0
2017/02/24 15:34:41.623496 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] boot/(77840) entering state SBooting
2017/02/24 15:34:44.422590 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:220] boot/(77840) received action message
2017/02/24 15:34:44.422616 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:148] boot/(77840) entering state SReady
2017/02/24 15:34:44.422631 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:328] boot/(77840) now sending slave boot request for default_bundle
2017/02/24 15:34:44.425115 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] default_bundle/(77842) initialized slave default_bundle with pid 77842 from parent 77840
2017/02/24 15:34:44.425162 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] default_bundle/(77842) entering state SBooting
2017/02/24 15:34:51.099618 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:220] default_bundle/(77842) received action message
2017/02/24 15:34:51.099713 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:148] default_bundle/(77842) entering state SReady
2017/02/24 15:34:51.099730 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:328] default_bundle/(77842) now sending slave boot request for development_environment
2017/02/24 15:34:51.099748 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:328] default_bundle/(77842) now sending slave boot request for test_environment
2017/02/24 15:34:51.103224 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] test_environment/(77850) initialized slave test_environment with pid 77850 from parent 77842
2017/02/24 15:34:51.103226 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] development_environment/(77849) initialized slave development_environment with pid 77849 from parent 77842
2017/02/24 15:34:51.103271 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] development_environment/(77849) entering state SBooting
2017/02/24 15:34:51.103318 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] test_environment/(77850) entering state SBooting
2017/02/24 15:35:05.378814 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:220] test_environment/(77850) received action message
2017/02/24 15:35:05.378847 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:148] test_environment/(77850) entering state SReady
2017/02/24 15:35:05.378857 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:328] test_environment/(77850) now sending slave boot request for test_helper
2017/02/24 15:35:05.383167 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] test_helper/(77856) initialized slave test_helper with pid 77856 from parent 77850
2017/02/24 15:35:05.383190 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] test_helper/(77856) entering state SBooting
2017/02/24 15:35:06.103102 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:220] development_environment/(77849) received action message
2017/02/24 15:35:06.103127 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:148] development_environment/(77849) entering state SReady
2017/02/24 15:35:06.103138 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:328] development_environment/(77849) now sending slave boot request for prerake
2017/02/24 15:35:06.108546 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:128] prerake/(77857) initialized slave prerake with pid 77857 from parent 77849
2017/02/24 15:35:06.108579 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:145] prerake/(77857) entering state SBooting
2017/02/24 15:35:06.298363 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:220] prerake/(77857) received action message
2017/02/24 15:35:06.298390 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:148] prerake/(77857) entering state SReady
2017/02/24 15:35:06.367293 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:151] test_helper/(77856) entering state SCrashed

@sideshowcoder
Copy link
Collaborator

@blimmer yeah I've been looking into this as well, one option would maybe be to try using a debugger, maybe https://github.com/derekparker/delve/ would do the trick. Sadly / luckily I don't have a project which experiences this, but I would really hope to be able to improve the error messages as well.

@blimmer
Copy link

blimmer commented Feb 27, 2017

My current process for testing this out to is clone the repo, run make && make install and then test in my repo - would something like delve work with this workflow?

The other crazy part about all of this is that the issue only exhibits itself (on the exact same codebase / macOS latest / etc) for some people on my team, not everyone.

@sideshowcoder
Copy link
Collaborator

Oh that sounds like its gonna be fun to debug... But yes delve should be able to help there see https://github.com/derekparker/delve/blob/master/Documentation/usage/dlv_attach.md for attaching to a running process

@seyonv
Copy link

seyonv commented Mar 7, 2017

@blimmer I was having problems with this too but got it working . Gem uninstalls and reinstalls ended up making it work. It does not work when running $bundle exec zeus start, but it does work when running $zeus start.

Something to note is that when I run

$zeus --log/dev/stderr start
it still gives
the following messages

2017/03/07 11:18:04.055498 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] test_helper/(no PID) entering state SUnbooted
2017/03/07 11:18:04.055511 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] default_bundle/(no PID) entering state SUnbooted
2017/03/07 11:18:04.055513 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] boot/(no PID) entering state SUnbooted
2017/03/07 11:18:04.055514 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] test_environment/(no PID) entering state SUnbooted
2017/03/07 11:18:04.055517 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] development_environment/(no PID) entering state SUnbooted
2017/03/07 11:18:04.056168 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:380] boot/(no PID) running the root command now
2017/03/07 11:18:04.055521 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:142] prerake/(no PID) entering state SUnbooted

@sideshowcoder
Copy link
Collaborator

@seyonv those messages look fine to me actually they are the trace log right?

@seyonv
Copy link

seyonv commented Mar 7, 2017

Yeah they're fine, shouldn't have mentioned them. Broader point is bundler causing failure and uninstalling, reinstalling different gems helped. As mentioned elsewhere, I believe the wrong versions of method_source and json were causing problems.

@sideshowcoder
Copy link
Collaborator

Cool sorry for the confusion 👍 yes this seems to help and I've seen it before as well, I got no idea why so 🐼

@blimmer
Copy link

blimmer commented Mar 8, 2017

I "fixed" this on my machine by running gem pristine --all. It's definitely weird and I don't know exactly what upstream gem caused the problem.

@tanmayforgit
Copy link

tanmayforgit commented Mar 13, 2017

In my case it was caused by these two lines in spec_helper

require 'database_cleaner'
require 'capybara/poltergeist'

I am using ruby 2.4 with Rails 5.0.1

@sideshowcoder
Copy link
Collaborator

@tanmayforgit how did you resolve it?

@kriskhaira
Copy link

kriskhaira commented Apr 19, 2017

Had a similar error today while running zeus start.

slavenode.go:215: [boot] read unix ->: EOF

Updating zeus from 0.15.10 to 0.15.13 fixes it. Not sure if it was the upgrade or simply a reinstall that fixed it. Could've been a conflict with a gem or Go library added to my system recently.

Environment

  • macOS Sierra 10.12.4 (16E195)
  • ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
  • Rails 4.2.7.1
  • Bundler version 1.13.7
  • go version go1.7.5 darwin/amd64
  • Homebrew 1.1.12 (used to install Go)

screen shot 2017-04-19 at 12 09 30 pm

@AlanRuijia
Copy link

In my case, updating bundler from 1.13.7 to 1.14.6 helps.

@sfahlberg
Copy link

yeah, this is really annoying. Would be nice if zeus could have this fixed internally so everybody doesn't have to pristine the gems. Didn't work for me though. Still having trouble

@kigster
Copy link
Contributor

kigster commented Oct 11, 2017

Hey, guys — I have spent a few days setting up Zeus in our dev environment, and I ended up learning a lot about what to expect when various weird things happen. The good news is that I think I've been able to resolve majority of our initial issues with Zeus, so let me walk through some use cases and what I've found, perhaps it will be helpful to somebody.

NOTE that Zeus 0.15.14 started to work on High Sierra, but was broken on Sierra.

My setup:

  • Mac OSX High Sierra
  • Ruby 2.2.7
  • Zeus 0.15.14 (my fork that prints commands in alphabetical order instead of the random — PR pending)
  • Bundler 1.15.4

Since Zeus is not supposed to be in your Gemfile, you are expected to install it separately. In the environments that Zeus boots, Bundler is initialized and used to load all bundled dependencies. A problem arises when Zeus code (or custom commands) use require and load some gems before bundler setup. In particular, if you have a version mismatch between what's installed as "gem install" and what's in your Gemfile.lock.

Crashes

We also experienced a bunch of SEGV crashes, that I was able to trace to the following gems. Each was exploding in a different place.

  • sqlite3 (removing it fixed the problem)
  • dalli (removing IPV6 alias for localhost fixed the problem)
  • faker gem (setting Faker::Config.random = Random.new in config/environment fixed it )
  • presence of the spring-commands-rspec gem in the Gemfile has been causing problems

With these cleaned up, Zeus appears very stable.

Hope this helps!

@typeoneerror
Copy link
Author

@kigster awesome detective work! of all your SEGV xp's, I have faker, so I'll see if your fix works. It appears faker was aware of the issue; looks like a ruby bug... faker-ruby/faker#982 (comment)

@jmgarnier
Copy link

@kigster What was your workflow to trace SEGV crashes? With zeus --log ?

@AnwarShah
Copy link

I experienced the same problem on Fedora 26 today. Though it was working on my Ubuntu. I just removed the Gemfile.lock file and used bundle install. It fixed the problem

@dmcinnes
Copy link
Contributor

I'm now getting failures on 0.15.13 as well 😞 and I'm not sure what changed.
slavenode.go:215: [bundler] read unix ->: EOF on 0.15.13 and
slavenode.go:226: [bundler] read unix ->: EOF on v0.15.14.

We're now on Ruby 2.4.2 for over a month (still on rbenv) and Bundler version 1.15.4.

@dmcinnes
Copy link
Contributor

Possibly related change: I'm on OS X Sierra and yesterday I had updated Xcode and command line tools to Version 9.0.1 and 9.0 respectively...

@kigster
Copy link
Contributor

kigster commented Oct 20, 2017

My workflow with SEGV is rather simple:

Look at the 5-7K lines of a stacktrace (make sure to set iterm2 screen history to unlimited), and find the first 100 or so lines. It the top of this stack will invariably be one of the gems I listed. If I see a new stack with no listed gems, I’d try to see the last few stacks: typically it’s a gem doing something via a native extension C callback.

However, segv is a good problem to have: you know when you have one. But I’ve also seen Zeus not start and almost nothing in any logs.

In that case I would try to run by hand a non-Zeus command, for example “rails console” instead of “Zeus console”: most of the time it explodes somewhere until fixed. When ruby VM that Zeus boots up throws parsing errors, there will be very little info why Zeus fails to start. So just manually start a new vm and hopefully you will see some errors.

HTH

@kliffy
Copy link

kliffy commented Oct 20, 2017

Also getting the same exact problem as @dmcinnes. Had to reformat the other day. None of these solutions seem to apply to me in getting zeus to work.

On High Sierra with ruby 2.1.1

@strickinato
Copy link

I was getting slavenode.go:226: [bundler] read unix ->: EOF

AnwarShahs solution worked for me.

I just removed the Gemfile.lock file and used bundle install. It fixed the problem

@alsutton
Copy link

You can set OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES as an environment variable as a workaround.

@kigster
Copy link
Contributor

kigster commented Nov 21, 2017

I found one additional issue that was happening to me. In my environment I use rbenv some of the time, but do not use it when I switch to chefdk ruby. So I changed the line in zeus.json that loads custom plan to the following:

{
  "command": "rbenv exec ruby -rubygems -r./lib/zeus/custom_plan.rb -eZeus.go",
}

Notice the rbenv exec ruby instead of just ruby. Maybe this will help someone else too.

@daliborfilus
Copy link

@alsutton Thanks! This worked in my case on zeus v0.15.14:

Available Commands: [waiting] [crashed] [ready]
zeus console (alias: c) [run to see backtrace]
zeus server (alias: s) [run to see backtrace]
zeus generate (alias: g) [run to see backtrace]
zeus destroy (alias: d) [run to see backtrace]
zeus dbconsole [run to see backtrace]
zeus rake [run to see backtrace]
zeus runner (alias: r) [run to see backtrace]
zeus test (alias: rspec, testrb) [run to see backtrace]
slavenode.go:226: [default_bundle] read unix ->: EOF
noice ~/code/crystalmails.com/crystalmails (master)

$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

$ zeus --log=./zeus.log start
Starting Zeus server v0.15.14
....
Available Commands: [waiting] [crashed] [ready]
zeus dbconsole
zeus rake
zeus runner (alias: r)
zeus console (alias: c)
zeus server (alias: s)
zeus generate (alias: g)
zeus destroy (alias: d)
zeus test (alias: rspec, testrb)

@anthony-bernardo
Copy link

anthony-bernardo commented Jan 18, 2018

How to debug when we have an error ? This is really annoying...

run to see backtrace

Run what ?

This project seems to be die.

@stevenleeg
Copy link

Running into this same issue and it doesn't look like any of the solutions above have fixed things for me. Is anyone else still seeing this?

@ecbrodie
Copy link

I'm running into this problem too now. I use Ruby 2.4.1 on a Rails 4.2.8 project. It was working fine yesterday, now everything has broken today.

@dyoung522
Copy link

dyoung522 commented Jan 31, 2018

Had the same problem:

slavenode.go:226: [bundler] read unix ->: EOF

Just to reiterate what others have said, logging the output is key to figuring out the problem:

zeus --log ./zeus.log start

In my case, I was getting:

2018/01/31 10:41:52.794658 [/Users/phil/Source/go/src/github.com/burke/zeus/go/processtree/slavenode.go:402] boot/(44312) root process exited with an error before it could boot: exit status 1; output was: /usr/local/var/rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:313:in check_for_activated_spec!': You have already activated byebug 9.1.0, but your Gemfile requires byebug 10.0.0. Prepending bundle exec` to your command may solve this. (Gem::LoadError)

and setting "byebug", "~> 9.1" in my Gemfile resolved the issue.

@cheshire137
Copy link

cheshire137 commented Feb 23, 2018

I'm on zeus 0.15.13.pre and started getting this error slavenode.go:215: [test_helper] read unix ->: EOF. I tried running bin/bundle and rerunning bin/zeus start but that didn't work. I also tried export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES before running bin/zeus start (I'm in macOS) but it also didn't work. The log file doesn't give details about what happened to test_helper, just that it crashed: it went from entering state SBooting to entering state SCrashed.

@kigster
Copy link
Contributor

kigster commented Feb 26, 2018 via email

@cheshire137
Copy link

Thanks! I got it working again, using this combination in the same terminal: script/bootstrap + bin/rake db:migrate db:test:prepare + bin/zeus start.

@botimer
Copy link
Contributor

botimer commented Mar 7, 2018

I've just been tracking this down for a couple of hours (on High Sierra / zeus 0.15.14). I'm not sure whether there should be a new issue opened or what, exactly.

The first thing I found was that pry is getting required without respect for the Gemfile.lock. This surfaced first as a version conflict with method_source because the newer pry I had installed generally (0.11) was pulling in a new version of method_source (0.9). It took some doing to find out where that previously activated version of method_source was coming from.

So, I think the main issue is that pry is getting loaded but not in the cautious way that method_source is. Two ideas are to 1) do something like the check for method_source, or 2) patch pry after the default bundle is loaded, and only if Pry is defined.

The secondary issue is that there seem to be lots of ways to get that basically silent failure, even with logging on. I guess that's probably over on the Go client side. I'm having a hard time getting my environment set up to build that (some constant uint64 overflow in a vendored dependency).

I'm going to have a look and see if option 2 above sorts this out.

@bjeanes
Copy link

bjeanes commented May 7, 2018

I'd like to see #654 merged to resolve the issue that caused this for me, but until then, this is how I've worked around it. I changed my config/zeus.rb to load the Gem::Specification for zeus, then manually setting up bundler load paths, then requiring zeus by adding its load path manually:

diff --git i/config/zeus.rb w/config/zeus.rb
index 0702e339a..7714c1557 100644
--- i/config/zeus.rb
+++ w/config/zeus.rb
@@ -1,3 +1,10 @@
+zeus = Gem::Specification.find_by_name('zeus')
+
+require 'bundler/setup'
+
+$LOAD_PATH.concat Dir[zeus.lib_dirs_glob]
 require 'zeus/rails'

 # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md

This more or less forces Zeus to load the version of pry (and therefore byebug, as in my case) that is locked by your Gemfile. If you don't have pry in your Gemfile, then this will cause zeus not to load its Pry patches at all, but if that's the case you probably aren't experiencing this Zeus failure for the same reason as myself and @botimer

@bjeanes
Copy link

bjeanes commented Jun 25, 2018

I started getting this again but this time it was @alsutton's OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fix that made it work again.

I googled that environment variable and found puma/puma#1421 pretty quickly which also discusses the underlying issue (which is related to changes in the way the fork syscall works in macOS). I tweaked their fix (which is puma specific) to make an equivalent one for Zeus. Add this to the top of your config/zeus.rb:

if /darwin/ =~ RUBY_PLATFORM
  require 'fiddle'
  # Dynamically load Foundation.framework, ~implicitly~ initialising
  # the Objective-C runtime before any forking happens
  Fiddle.dlopen '/System/Library/Frameworks/Foundation.framework/Foundation'
end

@smlparry
Copy link

smlparry commented May 22, 2019

Leaving this here as a solution to those who recently upgraded to Rails 5.2 (which added Bootsnap)

From: #641 (comment)

in boot.rb:

 require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
-require 'bootsnap/setup'
+require 'bootsnap/setup' unless ENV["ZEUS_MASTER_FD"]

This fixed it for me, when none of the other suggestions worked :)

@adfineberg
Copy link

@smlparry amazing! all the other ways failed, we also just upgraded to Rails 5 and I couldn't find any indication that this is the issue. How did you find that this is the problem?

@botimer
Copy link
Contributor

botimer commented Sep 18, 2019

We ran into something a week or so ago with bootsnap -- not zeus-specific, but may share some roots. We found that bootsnap -> sassc -> libsass was terminating with an illegal operation while loading the bundle for any bundle exec commands.

We were doing deployment of a vendored bundle across two machines with the same kernel, ruby, libffi, but the extension was somehow incompatible across them. We worked around it rather than solving, but I had some suspicion that ffi's extconf.rb was sniffing something about libffi / cpu flags incorrectly... Maybe a red herring, but seems potentially related.

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