Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Non deterministic behaviour of Request#getBeginNanoTime()

Hi,
we wanted to detect requests that were stuck in the Queue of the QueuedThreadPool for longer than 5 seconds. We therefore read Request#getBeginNanoTime() as soon as a request is dispatched and fail-fast in that case:

var pendingTime = NanoTime.secondsSince(_request.getBeginNanoTime());
if (pendingTime > 5) {  // send TooManyRequests with Retry-After} else {  // handle request}

We randomly get requests that are immediately dispatched but hit this requirement with several seconds of pendingTime and suspend our client. We're not quite sure what could cause this since System.nanoTime() should generally be safe to use across threads. Any ideas where the garbage time values could be coming from?

Thanks!

Best,
Matthias


Back to the top