This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
Added close on the channel after a port failure #276
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During a kubernetes deployment graylog may change location if the original pod closes and a new one opens. The DNS assigned to it will be updated appropriately but the gelf will never try to reconnect.
After a lot of debugging using the latest logstash-gelf and
It was identified that in the UDPSender.java and lines 54-58 there was a strange issue. The first
isConnected()
was correctly reporting false but the innerisConnected()
under theconnect()
function was incorrectly reporting true. The strange part was that the line that was forcingisConnected()
to return false was themyChannel.read(byteBuffer)
which was throwing an exception.In order to resolve this, the channel will be closed as soon as the port is unreachable (as there is no need to keep it open with an unreachable port ).
In order to test this ( as I couldn't simple test it with code. ) we did test it outside kubernetes for easier control.
2 graylog installations were deployed on 2 separate machines ( A , B ) and a new hosts entry was inserted into the machine running the java app with the gelf. the hosts entry was pointing to one of the machines (in which graylog was running) and in the other graylog was off. After the first 3-4 logs produced and correctly published to graylog the hosts entry was changed to point to the B machine and closed the graylog of A / opened graylog of B. As a result the messages were never redirected to the new machine without this change.