fix: Add noop
to request errors during cleanup
#142
Merged
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.
We noticed a potential race condition that's hard to reproduce (it only happened 29 times in the last 30 days in our production environment). Kibana crashes with
![image](https://private-user-images.githubusercontent.com/5469006/368986248-19598ea0-9608-4acf-8227-655829e4022c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNDA4MTEsIm5iZiI6MTczOTI0MDUxMSwicGF0aCI6Ii81NDY5MDA2LzM2ODk4NjI0OC0xOTU5OGVhMC05NjA4LTRhY2YtODIyNy02NTU4MjllNDAyMmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDIyMTUxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YjU3YWMyOGM0MjZjZmRkYWJlZGVlYzU3OGQ2OWMzNThkMjMzZTJkNTg4MjVhNDA5YmM3MDNmMzc4ZDg4ZjA2OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.7qBZs8LmFl_QJ6kzP9_Sgfr1MXl8r2M8QKakF3NroqE)
EPIPE
during write operations (task manager writing the result of a task, task manager claiming tasks, Kibana during the setup phase, and multiple POST requests).The lack of stack traces in Kibana (elastic/elasticsearch-js#2235) doesn't help to identify if it's related to one specific request or spread across multiple ones. But the gut feeling is a race condition where potentially, multiple errors are emitted at once and only one is caught, cleaning the listener, and the next one crashes the app.
Happy to close this PR if you think that this change is not safe/sensible.