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

Make usage of the new stop semantics to properly shutdown the plugin #10

Closed
wants to merge 6 commits into from
Closed

Make usage of the new stop semantics to properly shutdown the plugin #10

wants to merge 6 commits into from

Conversation

purbon
Copy link

@purbon purbon commented Sep 15, 2015

Implements stop to return from run according to elastic/logstash#3210

Depends on elastic/logstash-devutils#32 and elastic/logstash#3812

Fix #9

@jsvd
Copy link
Member

jsvd commented Sep 18, 2015

interrupt test works for me 👍

one failure in another test though:

Failures:

  1) LogStash::Inputs::Ganglia connection should receive and generate proper number of events
     Failure/Error: client.send(data)
     SocketError:
       send: name or service not known
     # ./spec/support/client.rb:19:in `send'
     # ./spec/inputs/ganglia_spec.rb:50:in `events'
     # ./spec/inputs/ganglia_spec.rb:49:in `events'
     # ./spec/spec_helper.rb:31:in `input'
     # ./spec/inputs/ganglia_spec.rb:48:in `events'
     # ./spec/inputs/ganglia_spec.rb:58:in `(root)'
     # /Users/joaoduarte/.rvm/gems/jruby-1.7.19/gems/rspec-wait-0.0.7/lib/rspec/wait.rb:46:in `(root)'

@guyboertje
Copy link

@pere - i think you need to pass a block to Stud.stoppable_sleep and not use the Stud.stop.
The block forces stoppable_sleep to check the plugin stop? and not use Stud.stop

  Stud.stoppable_sleep(5) { stop? }

@purbon
Copy link
Author

purbon commented Sep 18, 2015

@purbon
Copy link
Author

purbon commented Sep 18, 2015

HI,
I just rerun my test and everything is green as expected. for your error
report I can see the client/server was not working properly. I guess this
might come from rand(1000)+1025 just fixed that :-)

Thanks for testing this out man!

  • purbon

On Fri, Sep 18, 2015 at 1:27 PM João Duarte notifications@github.com
wrote:

tests failed for me

joaoduarte@Joaos-MacBook-Pro ...ogstash_plugins/logstash-input-ganglia (git)-[pr/10] % bundle exec rspec
Using Accessor#strict_set for specs
Run options: exclude {:redis=>true, :socket=>true, :performance=>true, :couchdb=>true, :elasticsearch=>true, :elasticsearch_secure=>true, :export_cypher=>true, :integration=>true, :windows=>true}
.FFF

Failures:

  1. LogStash::Inputs::Ganglia connection should receive the correct data
    Failure/Error: client.send(data)
    SocketError:
    send: name or service not known

    ./spec/support/client.rb:19:in `send'

    ./spec/inputs/ganglia_spec.rb:50:in`events'

    ./spec/inputs/ganglia_spec.rb:49:in `events'

    ./spec/spec_helper.rb:31:in`input'

    ./spec/inputs/ganglia_spec.rb:48:in `events'

    ./spec/inputs/ganglia_spec.rb:55:in`event'

    ./spec/inputs/ganglia_spec.rb:62:in `(root)'

    /Users/joaoduarte/.rvm/gems/jruby-1.7.19/gems/rspec-wait-0.0.7/lib/rspec/wait.rb:46:in`(root)'

  2. LogStash::Inputs::Ganglia connection should receive and generate proper number of events
    Failure/Error: client.send(data)
    SocketError:
    send: name or service not known

    ./spec/support/client.rb:19:in `send'

    ./spec/inputs/ganglia_spec.rb:50:in`events'

    ./spec/inputs/ganglia_spec.rb:49:in `events'

    ./spec/spec_helper.rb:31:in`input'

    ./spec/inputs/ganglia_spec.rb:48:in `events'

    ./spec/inputs/ganglia_spec.rb:58:in`(root)'

    /Users/joaoduarte/.rvm/gems/jruby-1.7.19/gems/rspec-wait-0.0.7/lib/rspec/wait.rb:46:in `(root)'

  3. LogStash::Inputs::Ganglia when interrupting the plugin behaves like an interruptible input plugin #stop returns from run
    Failure/Error: expect(plugin_thread).to be_alive
    expected #<Thread:0x2416a51 dead>.alive? to return true, got false
    Shared Example Group: "an interruptible input plugin" called from ./spec/inputs/ganglia_spec.rb:17

    /Users/joaoduarte/projects/logstash-devutils/lib/logstash/devutils/rspec/shared_examples.rb:14:in `(root)'

    /Users/joaoduarte/.rvm/gems/jruby-1.7.19/gems/rspec-wait-0.0.7/lib/rspec/wait.rb:46:in`(root)'

Finished in 0.795 seconds (files took 2.49 seconds to load)
4 examples, 3 failures

Failed examples:

rspec ./spec/inputs/ganglia_spec.rb:61 # LogStash::Inputs::Ganglia connection should receive the correct data
rspec ./spec/inputs/ganglia_spec.rb:57 # LogStash::Inputs::Ganglia connection should receive and generate proper number of events
rspec /Users/joaoduarte/projects/logstash-devutils/lib/logstash/devutils/rspec/shared_examples.rb:9 # LogStash::Inputs::Ganglia when interrupting the plugin behaves like an interruptible input plugin #stop returns from run

Randomized with seed 59362


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

@@ -32,14 +32,15 @@ def register

public
def run(output_queue)
@current_thread = Thread.current

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, why keep a reference to current thread?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a leftover 😞 will cleanup

@guyboertje
Copy link

Bon!
LGTM

@elasticsearch-bot
Copy link

Merged sucessfully into master!

@purbon purbon closed this in 993d6a8 Sep 21, 2015
purbon pushed a commit that referenced this pull request Sep 21, 2015
purbon pushed a commit that referenced this pull request Sep 21, 2015
….stop! method from the stop plugin method

Fixes #10
purbon pushed a commit that referenced this pull request Sep 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants