-1 Failed to initialize thread pool of size 16: -3

index
secondary
query

#1

I implemente to access aerospike by C. When a large amount of requests were issued, the below error occurred.

 -1 - Failed to initialize thread pool of size 16: -3 
 -1 - Failed to initialize thread pool of size 16: -3
 -1 - Failed to initialize thread pool of size 16: -3

The implementation is like the following.

as_error err; as_config config; as_config_init(&config);

aerospike as; aerospike_init(&as, &config);

if (aerospike_connect(&as, &err) != AEROSPIKE_OK) {

log(err.code, err.message);
aerospike_destroy(&as);

}

// aerospike read or write access

I don’t implement to close and destroy aerospike connection when the access is normal. Because I reuse the connection. Why aerospike connection was failed when a large amount of requests were issued,

Could you take an advice.


#2

That error message occurs when pthread_create() fails for one of 16 threads in thread pool. I guess that your OS has a limited number of threads available and failed on pthread_create().

You could reduce your thread pool size and see if that helps. Also, if you are not performing any synchronous batch, scan or query commands, then you can try setting the thread pool size to zero.

as_config config;
as_config_init(&config);
config.thread_pool_size = <smaller thread pool size>;

#3

I made the thread pool size smaller, and then it was solved. Thank you very much for your help.