You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
I replied to the post you mentioned, and I don't think this constitutes a bug. The eventLoop is designed to only be released at the end of the process execution, and the same eventLoop should be referenced rather than creating and destroying multiple eventLoops. Using the workaround provided in the discussion post above, we should be able to maintain this behavior.
Hi @DomPeliniAerospike. Thank you for such a detailed and clear answer. I learned a lot from it and will try to rewrite our tests.
I still have one question left - what's the use of the releaseEventLoop parameter in Client.close() method? As far as I understood from code (please correct me if I'm wrong):
Client.close() will call EventLoop.releaseEventLoop() for the last connection (OK)
EventLoop.releaseEventLoop() will call native C function release_as_event_loop() from aerospike.cc (OK)
release_event_loop() will call as_event_close_loops() function from Aerspike C client library (OK)
as_event_close_loops() will do nothing - will not call as_event_destroy_loops() as as_event_threads_created = false (set by call to as_event_set_external_loop_capacity() from aerospike.cc:register_as_event_loop()) (not OK)
This means that Client.close(true) will never release event loop. Does it have some other use? What's the purpose of releaseEventLoop parameter?
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, subsequentClient.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 insideif (as_event_threads_created && status){...}
block, butClient.connect()
callsas_event_set_external_loop_capacity(1)
, which in turn setsas_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
The text was updated successfully, but these errors were encountered: