aws / aws-lambda-runtime-interface-emulator

Apache License 2.0
936 stars 99 forks source link

Fix already reserved panic on concurrent invokes #133

Open OJFord opened 1 month ago

OJFord commented 1 month ago

Issue #, if available: #97

Description of changes:

Fixes the error:

[INFO] (rapid) ReserveFailed: AlreadyReserved panic: runtime error: invalid memory address or nil pointer dereference

when there are multiple concurrent invocations.

Essentially, make the entire Invoke() call acquire mutex, and then remove others to avoid deadlock. I am not sure this is an entirely appropriate solution, but it does seem to work for me.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.