Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Add constant write backoff in GelfTCPSender for cases when a sender c… #249

Closed
wants to merge 2 commits into from

Conversation

netudima
Copy link
Contributor

…annot write any bytes to the socket channel several times. Limit the time to stay in such mode.

fixes #248

…annot write any bytes to the socket channel several times. Limit the time to stay in such mode.
Copy link
Owner

@mp911de mp911de left a comment

Choose a reason for hiding this comment

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

Looks good for the first iteration. I left a few comments to address.

} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
long sleepTimeMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
Copy link
Owner

Choose a reason for hiding this comment

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

Nano time is prone for overflows. Millis should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could you please share more details (maybe some link to the description) regarding this issue?
it is a common pattern of nanotime usage..
Regarding overflow I am aware only about this point:
https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#nanoTime--
Differences in successive calls that span greater than approximately 292 years (2^63 nanoseconds) will not correctly compute elapsed time due to numerical overflow.
System.currentTimeMillis() may have not enough precision in some cases.

…new parameters to docs, stop attempts to send a message in case of InterruptedException
@mp911de mp911de added this to the 1.14.1 milestone Jul 24, 2020
mp911de pushed a commit that referenced this pull request Jul 28, 2020
for cases when a sender cannot write any bytes to the socket channel several times. Limit the time to stay in such mode.
stop attempts to send a message in case of InterruptedException.

Original pull request: #249
mp911de added a commit that referenced this pull request Jul 28, 2020
Extract BackOff capping into BoundedBackOff. Add BackOff to TCP SSL sender. Add unit tests for BackOff, reformat code, Javadoc.

Original pull request: #249
@mp911de mp911de added the type: enhancement A general enhancement label Jul 28, 2020
@mp911de
Copy link
Owner

mp911de commented Jul 28, 2020

Thank you for your contribution. That's merged and polished now.

@mp911de mp911de closed this Jul 28, 2020
@netudima
Copy link
Contributor Author

Thank you a lot for the quick responses.
Could you please clarify do you have some plans regarding a release of the next version?

@mp911de
Copy link
Owner

mp911de commented Jul 28, 2020

1.14.1 is available from Maven Central. I decided to ship a release earlier this morning since the last one was shipped about 6 months ago.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GelfTCPSender#write burns CPU in case of a slow graylog server
2 participants