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

`validate_and_sanitize_new_state': Listen::Listener can't change state from 'backend_started' to 'stopped', only to: frontend_ready #822

Closed
jinleileiking opened this issue Apr 8, 2016 · 7 comments · Fixed by y-yagi/travel_base#472

Comments

@jinleileiking
Copy link

18:26:49 - INFO - Guard::Minitest 2.4.4 is running, with Minitest::Unit 5.4.3!
18:26:49 - INFO - Running: all tests
Run options: --seed 20199

# Running:



Finished in 0.000771s, 0.0000 runs/s, 0.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips

/home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/listen-3.0.6/lib/listen/fsm.rb:76:in `validate_and_sanitize_new_state': Listen::Listener can't change state from 'backend_started' to 'stopped', only to: frontend_ready (ArgumentError)
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/listen-3.0.6/lib/listen/fsm.rb:55:in `transition'
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/listen-3.0.6/lib/listen/listener.rb:98:in `stop'
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:48:in `ensure in execute'
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:56:in `execute'
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
        from /home/users/jinlei04/.jumbo/lib/ruby/gems/2.2.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'
@e2
Copy link
Contributor

e2 commented Apr 8, 2016

I understand what's wrong. I think I can fix it. But I can't reproduce this myself.

Can you share a simple repository producing this error? I just want to make sure it's fixed properly.

@1v
Copy link

1v commented Apr 30, 2016

Same error on startup:

11:34:46 - INFO - Guard::RSpec is running
FATAL: Listen error: unable to monitor directories for changes.
Visit https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers for info on how to fix this.
/home/luna/.rvm/gems/ruby-2.3.0/gems/listen-3.0.6/lib/listen/fsm.rb:76:in `validate_and_sanitize_new_state': Listen::Listener can't change state from 'backend_started' to 'stopped', only to: frontend_ready (ArgumentError)
    from /home/luna/.rvm/gems/ruby-2.3.0/gems/listen-3.0.6/lib/listen/fsm.rb:55:in `transition'
    from /home/luna/.rvm/gems/ruby-2.3.0/gems/listen-3.0.6/lib/listen/listener.rb:98:in `stop'
    from /home/luna/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:48:in `execute'
    from /home/luna/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
    from /home/luna/.rvm/gems/ruby-2.3.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'

I can't increase watchers because I'm on VPS.

$ cat /proc/sys/fs/inotify/max_user_watches
8192
$ sudo sysctl fs.inotify.max_user_watches=524288
sysctl: permission denied on key 'fs.inotify.max_user_watches'

Other app with same Guardfile is working without any errors.

guard :rspec, cmd: "bundle exec rspec" do
  watch(%r{^(app|spec|config|lib)/(.+)}) { "spec" }
end

@1v
Copy link

1v commented Apr 30, 2016

One-liner to reproduce:

mkdir -p {01..10}/{01..10}/{01..10}/{01..10} && guard init && guard

@e2
Copy link
Contributor

e2 commented Apr 30, 2016

Thanks, @1v - that was enough for me to properly test and fix this.

Will be released soon. (for both Listen 3.1 and 3.0).

@e2
Copy link
Contributor

e2 commented Apr 30, 2016

Released in 3.1.2: https://github.com/guard/listen/releases/tag/v3.1.2
Released in 3.0.7 (backport) : https://github.com/guard/listen/releases/tag/v3.0.7

@1v - you'll still get the error from watching more directories than INotify allows you. You can either:

  • watch less directories (see guard directories option)
  • use polling
  • use symlinks to an outside directory

@1v
Copy link

1v commented May 2, 2016

I excluded some dirs like that:

 bundle exec guard -w `find . -maxdepth 1 -type d -not -path "./tmp" -not -path "./public" -not -path "./.git" -not -path "./log" -not -path "."`

@e2
Copy link
Contributor

e2 commented May 2, 2016

I think ignored directories in Guard shouldn't be watched by default (if possible): #829

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 20, 2016
Restrict to ruby22 and ruby23.

v3.1.5

Bugfixes

    * #394 prevent crashes when Listen is stopped too soon (e.g. before
      being started or initialized)


v3.1.4

Bugfixes

    * #393 - relaxed rb-fsevent dependency to allow install on older OSX
      releases (thanks to @robmckinnon)


v3.1.3

Bug fixes

    * #387 - fix JRuby support both in dependencies (by allowing Ruby 2.2.3)
      and behavior (JRuby Dir.entries workaround)
    * #387 - prevent JRuby from hanging when stopping on Linux (and Travis)
    * #387 - activate JRuby-9.0.5.0 on Travis to declare support for JRuby
      (tests are flaky, but that's due to timing issues)


v3.1.2

Security enhancements

    * #377 require at least Ruby 2.2.4 to avoid CVE-2015-7551 (see
      https://www.ruby-lang.org/en/news/2015/12/16/ruby-2-2-4-released/)

Bugfixes

    * #383 allow stopping when not fully initialized (fixes guard/guard#822
      (comment))

Improvements

    * #378 warn users if their Ruby is buggy or vulnerable (controversial to
      some, but very extensively justified)

Development

    * #377 use ruby_dep for managing ruby requirements
    * #379 make RuboCop pass (thanks to @jvanbaarsen)
    * #384 avoid rubygems duplicate dependency error (gem given in both
      runtime and development dependencies)


v3.1.1

Bugfixes

    * #373 explicitly require forwardable for delegation (fixes #372)


v3.1.0

Bugfixes

    * #370 - gracefully fallback to polling on old older unsupported OSX
      versions (thanks to @vaz)

Improvements

    * #371 - update dependency to Ruby 2.2.x since 2.1 and earlier are EOL
      (minor version bumped to 3.1 in case backporting is needed)

Development

    * #371 - fix all RuboCop offenses to avoid noise during development
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

Successfully merging a pull request may close this issue.

3 participants