sdk-go
sdk-go copied to clipboard
EventReceiver ServeHTTP returns early
Starting in v2.4.1, the EventReceiver ServeHTTP handler seems to sometimes return before the user provided function that is called by the receiveInvoker; cancelling the request context passed to the user provided function prematurely.
The attached code can be used to reproduce the issue.
main.txt
The code logs twice for every event, once in the user provided receive function and once after the EventReceiver ServeHTTP handler has returned. The logs are tied to the same event using the uuid added to the context in the middleware function.
I observed numerous logs coming from the receive function where the context had been canceled (search for context cancel), each of which had a corresponding log from after the EventReceiver ServeHTTP handler returned. The log after the ServeHTTP handler came before the receive function log (it shows the context had not yet been canceled)