Description
While running tests from different modules via Jest I encountered an issue that Client.close(true)
does not close the underlying event loop. As a result, subsequent Client.connect()
calls fail with "Unable to register default event loop: Failed to add external loop. Capacity is 1 [-1]".
As far as I've investigated, the root cause is a bug inside Aerospike C client: https://github.com/aerospike/aerospike-client-c/blob/master/src/main/aerospike/as_event.c#L338. as_event_destroy_loops()
is called inside if (as_event_threads_created && status){...}
block, but Client.connect()
calls as_event_set_external_loop_capacity(1)
, which in turn sets as_event_threads_created = false
. As a result, as_event_destroy_loops()
never gets called.
See more details here: https://discuss.aerospike.com/t/jest-sequentially-run-tests-are-failed/10307/8