elasticsearch icon indicating copy to clipboard operation
elasticsearch copied to clipboard

Graph: fix race condition in timeout

Open nik9000 opened this issue 2 years ago • 3 comments

Previously graph checked if the request timed out, then spent some time doing work, then passed the timeout on to the next request. Over and over again. It's quite possible that the response may not have timed out for the first check but would have timed out for the second check. This manifests as the timeout being sent to the next hop being a negative number of milliseconds. We don't allow this sort of thing.

This fixes this by moving the timeout check to the same spot it is read for setting the timeout on the next request - we just check if its > 0 to find the timeouts.

This does keep the request running slightly longer after it's officially timed out - but it's just long enough to prepare the next layer of request. Usually microseconds. Which should be fine.

Closes #55396

nik9000 avatar Jul 29 '22 14:07 nik9000

Hi @nik9000, I've created a changelog YAML for you.

elasticsearchmachine avatar Jul 29 '22 14:07 elasticsearchmachine

Pinging @elastic/es-analytics-geo (Team:Analytics)

elasticsearchmachine avatar Jul 29 '22 14:07 elasticsearchmachine

@elasticmachine run elasticsearch-ci/packaging-tests-unix-sample

nik9000 avatar Aug 01 '22 12:08 nik9000