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

No such file or directory @ rb_sysopen - tmp/rspec_guard_result #326

Closed
dgmstuart opened this issue Jun 19, 2015 · 19 comments
Closed

No such file or directory @ rb_sysopen - tmp/rspec_guard_result #326

dgmstuart opened this issue Jun 19, 2015 · 19 comments

Comments

@dgmstuart
Copy link

I'm getting the following failure, intermittently but very regularly:

Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/rspec_guard_result

Here's the command I'm running with guard:

guard :rspec, cmd: "zeus rspec --tag ~js", all_after_pass: true, failed_mode: :none do

The error might be only when running acceptance specs with capybara, but it looks like it's failing before actually running any specs and I haven't been able to narrow it down because it's happening maybe once in every 15 runs.

Sounds similar to #316 and maybe #314, but @e2 said to report crashes as new issues (#316 (comment))

I'm using:

  • guard-rspec-4.5.2
  • rspec 3.2.0
  • ruby 2.2.0
  • rails 4.2.2

Project: https://github.com/dgmstuart/swingoutlondon2/tree/ad42c55c2b6dbd79be3487fc155e3d967a673448

Stack trace:

Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/rspec_guard_result
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/results.rb:11:in `readlines'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/results.rb:11:in `initialize'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:76:in `new'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:76:in `_command_output'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:94:in `_process_run_result'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:47:in `block in _run'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:45:in `tap'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:45:in `_run'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:32:in `run'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec.rb:42:in `block in run_on_modifications'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec.rb:48:in `_throw_if_failed'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec.rb:42:in `run_on_modifications'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:82:in `block in _supervise'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:79:in `catch'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:79:in `_supervise'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:61:in `block (3 levels) in run_on_changes'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:56:in `each'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:56:in `block (2 levels) in run_on_changes'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:119:in `block (2 levels) in _run_group_plugins'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:117:in `each'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:117:in `block in _run_group_plugins'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:116:in `catch'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:116:in `_run_group_plugins'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:54:in `block in run_on_changes'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:53:in `each'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/runner.rb:53:in `run_on_changes'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/internals/queue.rb:23:in `process'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/commander.rb:43:in `start'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/cli/environments/valid.rb:16:in `start_guard'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/cli.rb:122:in `start'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/aruba_adapter.rb:32:in `execute'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-2.12.6/bin/_guard-core:11:in `<main>'

Actually it comes out with odd staggering in my terminal, so it's more like this:

Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
                                                                                            > [#] Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/rspec_guard_result
                       > [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/results.rb:11:in `readlines'
                                                                                                                                                        > [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/results.rb:11:in `initialize'
                                                                                                                                 > [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/guard/rspec/runner.rb:76:in `new'
                                                                                                  > [#] /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/guard-rspec-4.5.2/lib/g
# etc...
@e2
Copy link
Contributor

e2 commented Jun 23, 2015

Thanks for the report. It's failing in a completely different area: either the test output file is not being created, or it's deleted before it's being processed (or something just as strange).

Guard::RSpec uses a custom formatter (lib/guard/rspec_formatter.rb), which is supposed to create a file with the test results. RSpec is supposed to call the formatter's :dump_summary method, which writes the RSpec failures into a file tmp/rspec_guard_result (relative to the current directory).

You might try the Guard::RSpec cmd_additional_args options to redirect any output, e.g.

guard :rspec, cmd: "zeus rspec --tag ~js", all_after_pass: true, failed_mode: :none, cmd_additional_args: ' | tee -a rspec_errors.log' do

RSpec could be crashing for some reason - and zeus may be hiding the output when that happens.

If this is still relevant and you have time, let me know and I'll add some debugging/diagnostics for you to check - to find out what happens in the formatter before you're getting this error.

@dgmstuart
Copy link
Author

Thanks for the reply. Debugging/diagnostics would be great - I'm happy to spend some time getting to the bottom of this :)

@dgmstuart
Copy link
Author

Also, now that you say that about the formatter I'm wondering if the issue could be that I'm using the Fuubar formatter, which probably behaves a bit differently to other formatters. I'll try it without that.

@e2
Copy link
Contributor

e2 commented Jun 23, 2015

I've create a branch which logs calls and errors related to the formatter:

In your Gemfile:

gem 'guard-rspec', github: 'guard/guard-rspec', branch: 'debug_logging_for_formatter'

and run: bundle update guard-rspec

If you get the error again, there should be some hints in the guard_rspec_debug.log file.

I'll work out some proper diagnostic mode (and release it) once we get to the bottom of this.

Thanks!

@dgmstuart
Copy link
Author

Awesome! Thanks - I'll enable this when I'm in that code next.

On 23 June 2015 at 14:56, Cezary Baginski notifications@github.com wrote:

I've create a branch which logs calls and errors related to the formatter:

In your Gemfile:

gem 'guard-rspec', github: 'guard/guard-rspec', branch: 'debug_logging_for_formatter'

and run: bundle update guard-rspec

If you get the error again, there should be some hints in the
guard_rspec_debug.log file.

I'll work out some proper diagnostic mode (and release it) once we get to
the bottom of this.

Thanks!


Reply to this email directly or view it on GitHub
#326 (comment).

@e2 e2 added the info needed label Jun 26, 2015
@dgmstuart
Copy link
Author

Hmm - I've got another crash, but the debug log doesn't show anything unusual:

D, [2015-07-10T17:10:33.806805 #44628] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:10:33.807023 #44628] DEBUG -- : write_summary: 108 examples 
D, [2015-07-10T17:13:50.837635 #44686] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:13:50.838233 #44686] DEBUG -- : write_summary: 1 examples 
D, [2015-07-10T17:13:59.471677 #44702] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:13:59.471944 #44702] DEBUG -- : write_summary: 1 examples 
D, [2015-07-10T17:14:04.312027 #44717] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:14:04.312240 #44717] DEBUG -- : write_summary: 1 examples 
D, [2015-07-10T17:14:15.913445 #44733] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:14:15.913666 #44733] DEBUG -- : write_summary: 1 examples 
D, [2015-07-10T17:15:16.871907 #44762] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:15:16.872476 #44762] DEBUG -- : write_summary: 23 examples 
D, [2015-07-10T17:15:21.101407 #44772] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:15:21.101632 #44772] DEBUG -- : write_summary: 23 examples 
D, [2015-07-10T17:15:25.763609 #44788] DEBUG -- : dump_summary writing summary
D, [2015-07-10T17:15:25.763826 #44788] DEBUG -- : write_summary: 23 examples 

Repeated a couple of times with the same results.
No apparent difference between using the fuubar formatter and the default

@e2
Copy link
Contributor

e2 commented Jul 10, 2015

I sent a PR to fix the issues with Guard::RSpec - since you're using Zeus, there's a special workaround (mentioned in the Readme). Maybe I should detect the issue better.

The results of running zeus test on your project:

Pending: (Failures listed here are expected and do not affect your suite's status)
  1) EventGenerator Validations validates that date is a date
     # Not yet implemented
     # ./spec/models/event_generator_spec.rb:13
  2) EventInstance Validations validates that date is a date
     # Not yet implemented
     # ./spec/models/event_instance_spec.rb:12
  3) Admin adds an event with invalid venue postcode
     # Not yet implemented
     # ./spec/acceptance/create_event/create_event_with_venue_spec.rb:27
Finished in 12.9 seconds (files took 8.1 seconds to load)
110 examples, 0 failures, 3 pending
Randomized with seed 57825

If you have a different issue, just open a new issue and link to the repo so I can reproduce this.

Thanks very much for the reports and the repo to test - it helped a lot!

@e2
Copy link
Contributor

e2 commented Jul 10, 2015

Sorry - there's still an issue when running from Guard - I'll check it out...

@dgmstuart
Copy link
Author

@e2 the error complained about

tmp/rspec_guard_result

While the zeus config sets

tmp/guard_rspec_results.txt

Is that intended?

@e2
Copy link
Contributor

e2 commented Jul 10, 2015

I'll need to rework the error handling completely, because it's too complex to work out what's the problem and how to fix it.

@dgmstuart
Copy link
Author

OK - many thanks for looking into it!

@e2 e2 closed this as completed in 8c6d94b Jul 10, 2015
e2 added a commit that referenced this issue Jul 10, 2015
@e2
Copy link
Contributor

e2 commented Jul 10, 2015

Released as 4.6.1. Open new issues if you have any.

In 4.6.1, if you don't have a custom Zeus plan, there should be a warning linking to this wiki entry: https://github.com/guard/guard-rspec/wiki/Warning:-no-environment

I should create a PR for Zeus for this though ...

@dgmstuart
Copy link
Author

Great - thanks so much for your work ❤️

@e2
Copy link
Contributor

e2 commented Jul 10, 2015

Glad to help! I wish this all could be a lot simpler. Web development is hard work these days...

@vyorkin
Copy link

vyorkin commented Feb 3, 2016

I've got the same error :( I'm on rails 5 btw

@suranyami
Copy link
Member

I'm getting this with monotonous regularity now.

@dgmstuart
Copy link
Author

@vyorkin @suranyami Are you on guard-rspec 4.6.1 or later? If not, please upgrade, and if so then please follow the advice above and raise new issues.

You'll want to include the following:

  • Gem versions
  • The exact guard command you're running
  • The full console output that you're getting

Also try passing the -b flag in your guard command to see if that gives you a more detailed backtrace.

Good luck :)

@suranyami
Copy link
Member

See comments in #359

@dgmstuart
Copy link
Author

@suranyami 👍

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

No branches or pull requests

4 participants