-
Notifications
You must be signed in to change notification settings - Fork 22
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
Refactor plugin shutdown #59
Conversation
@jsvd a lot less of code to review. |
# Wrappingu the accept call into a CircuitBreaker | ||
if @circuit_breaker.closed? | ||
connection = @lumberjack.accept # Blocking call that creates a new connection | ||
|
||
invoke(connection, @codec.clone) do |_codec, line, fields| | ||
if stop? | ||
connection.close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this connection.close operation happen in bookkeeping? like:
def close
@connection.close
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lumberjack.close is already done in def close
which close the server socket.
connection.close
stop reading from the client socket, this allow a bit more graceful shutdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually only in def stop
, but I guess the argument is valid :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups yes stop
, copy paste the other argument ;)
@jsvd did I have answered all your concerns here? |
tests pass but a "real life" test using this pr, ruby-lumberjack master and logstash 2.0 receiving events from logstash 1.5.4 failed:
|
1.5.4 was using the bundled version of the input or the master branch? |
Gracefully stop the lumberjack server and make sure any frame in transit will be resend.
When we are in the process of closing the server `lumberjack#accept` can return a nil object because now the call is non blocking we have to check if have an actual connection before invoking it.
@ph bundled version. is that reason enough to trigger these bugs on the server side? |
Seem to be in the library, joy
|
Too many block makes your head go boooooom! The problem and the fix is really simple. 🌴 Since the execution is in a block and the parent is also a block and blocks works like Proc and not lambda (which behave correctly with a return). If the proc you are calling is doing a return the parent function need to return something too if it doesn't you will get the LocalJump error this is related to how scoping work I believe. I havent investigated much Two way of fixing this:
|
c57e24d
to
6dba6e1
Compare
6dba6e1
to
1173a0a
Compare
@jsvd this should fix the problem you had before. 💃 |
LGTM |
Gracefully stop the lumberjack server and make sure any frame in transit
will be resend.
require elastic/ruby-lumberjack#13