-
Notifications
You must be signed in to change notification settings - Fork 163
Avoid sending double CRLF keep alive on TCP socket shutdown #172
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
Open
fre42
wants to merge
3
commits into
RestComm:master
Choose a base branch
from
fre42:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
how about wrapping this in a new method, e.g.
sendCrlfToWakeUpPipe(hispipe)then we don't need comments!! ; ) \ o /
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.
Im not sure we can savely assume this branch is becuase of socket closed, certainly the inputstream has reached end. I can see the original author probably choosed doubleCRLF becuase is an small message,yet still valid under the heartbeat Spec. sending a single CRLF may cuase issues for some remote peers, who knows?
If the original concern of the PR is that " sometimes this will lead to the error message", why dont we try to review the log level of that message?. Jain-SIP stack is known to be quite verbose,and not using log level conventions properly. We have tried to alleviate this several times by reducing the log level, but there might be still some messages to tweak.
Uh oh!
There was an error while loading. Please reload this page.
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.
@gsaslis: Yes, I think the only reason for sending a double CRLF was to wakeup the pipe. Therefore the new method would cover it.
@jaimecasero: when sending the double CRLF the to wake up the pipe the pipe will handle this double CRLF and tries to send a single CRLF. This does not make sense in the case of shutting down. Therefore I was wondering why to send just this double CRLF where there are other possibilities to wake up the queue.
Unfortunately it's not only one error message that comes up in the case where mySock is still there and not closed in sendSingleCRLF() and the sendMessage() is called (which causes the errors). This is a race condition. The error messages looks ugly when it happens:
2018-02-05 19:22:37,842 WARN nist.javax.sip.stack.IOHandler [] IOException occured retryCount 0
2018-02-05 19:22:37,842 ERROR nist.javax.sip.stack.IOHandler [] Problem sending: sendBytes TCP inAddr 12.23.165.59 port = 57550 remoteHost 12.23.165.59 remotePort 57550 peerPacketPort 57550 isClient false
2018-02-05 19:22:37,842 ERROR nist.javax.sip.stack.IOHandler [] {}
2018-02-05 19:22:37,842 ERROR nist.javax.sip.stack.IOHandler [] Could not connect to /12.23.165.59:57550
2018-02-05 19:22:37,842 WARN nist.javax.sip.stack.TCPMessageChannel [] Failed to connect /12.23.165.59:57550 but trying the advertised port=57550 if it's different than the port we just failed on
2018-02-05 19:22:37,842 WARN nist.javax.sip.stack.TCPMessageChannel [] Couldn't connect to peerAddress = /12.23.165.59 peerPort = 57550 key = tcp:12.23.165.59:57550 retrying on peerPortAdvertisedInHeaders 57550