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

New configuration option to allow socket to use TCP keep-alive #116

Closed
wants to merge 3 commits into from

Conversation

jakelandis
Copy link
Contributor

No description provided.

@jakelandis jakelandis requested a review from jsvd April 13, 2018 15:18
@jakelandis
Copy link
Contributor Author

Here is how i confirmed it is working:

With the following config:

input { 
	tcp {  port => 55115      }
}

output { 
   stdout { 
       codec => rubydebug { metadata => true }
      }
} 

start logstash

from a different window:

irb
require 'socket'
socket = TCPSocket.new("localhost", 55115)
socket.write "hi"
#not closing connection

validate the ESTABLISHED state : netstat -an | grep 55115

wait a couple hours and ensure via wireshark that the tcp keep alive packet is sent

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

On second thought, I think this enough of a breaking change to warrant a new boolean option of tcp_keepalive or similar that is false by default.
We can make it true by default in future versions

@jakelandis jakelandis changed the title Instruct (non-SSL) socket to use TCP keep-alive New configuration option to allow socket to use TCP keep-alive Jun 4, 2018
@jakelandis
Copy link
Contributor Author

code has been updated with the option, and now applies to SSL connection too.

I still need to finish testing this which takes bit since I need to hold open a connection for a few hours.

@jsvd
Copy link
Member

jsvd commented Jun 4, 2018

you can test it faster by reducing the keepalive. On osx:

sudo sysctl -n net.inet.tcp.keepidle=360000

Value is in milliseconds, so 360000 is 10 minutes (default is 7200000, 2 hours)

@jakelandis
Copy link
Contributor Author

@jsvd - can you take another look, I added 2 more commits since last review.

e490989
052501a

I could never get the keep alives to fire from TLS / Ruby side of things. The code (now) is by all accounts is correct, and having burned way to many hours trying to debug, I am calling TLS + keep alive possibly supported ( I think there may be an issue with JRuby). ... anyway there is PR we should finish up to convert the TLS side of the plugin over to Java, which has many more benifits then just keep alives firing properly when TLS is configured: #106

non-TLS (Java/Netty implementation ) tested to work exactly as expected.

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticsearch-bot
Copy link

Jake Landis merged this into the following branches!

Branch Commits
master 2358c03, ed838d1, 2033627

elasticsearch-bot pushed a commit that referenced this pull request Jun 8, 2018
elasticsearch-bot pushed a commit that referenced this pull request Jun 8, 2018
@jakelandis
Copy link
Contributor Author

thanks @jsvd !

@kares kares mentioned this pull request Sep 25, 2020
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 this pull request may close these issues.

3 participants