Librdkafka: rd_clock() wraps on Windows after 7+ days

Created on 3 Sep 2018  路  8Comments  路  Source: edenhill/librdkafka

Depending on the host-dependent PerformanceCounter frequency, the calculation
in rd_clock() may wrap after 7 days of uptime.
Since rd_clock() is assumed to be a monotonic clock this wrap will lead to timers, timeouts, etc, stop working.

Original .NET issue: https://github.com/confluentinc/confluent-kafka-dotnet/issues/603

Introduced in v0.11.5

CRITICAL bug windows

All 8 comments

@edenhill thanks for the fix. Is there any ETA for a librdkafka.redist release?

We'll start the release cycle with an RC later this week, with a final release late next the earliest.

I've just found the issue.
May be below fix little more clean (I didn't check it):

return (now.QuadPart / freq.QuadPart) * 1000000 + ((now.QuadPart % freq.QuadPart) * 1000000) / freq.QuadPart;

**move from #998

Is there a problem with the existing fix?

I believe* existing fix solves the issue, but I just don't like convert int to double and back, because it's slower and not so accurate as integer.

*I need a time to make internal release to recheck it.


All works fine. Thank you.

see confluentinc/confluent-kafka-dotnet#603 (comment)

Hmmm, existing fix almost two times faster of mine. Thank you for this.

Was this page helpful?
0 / 5 - 0 ratings