# Exception in aerospike\_batch\_get C client lib 4.6.17

**URL:** <https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793>\
**Category:** C Client Library\
**Created:** [August 30, 2020, 9:39am UTC](https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793 "2020-08-30T09:39:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikrantl](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vikrantl](https://discuss.aerospike.com/u/vikrantl)\
**Post date:** [August 30, 2020, 9:39am UTC](https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793/1 "2020-08-30T09:39:40Z")

</div>

as\_main\_single\_async\_get: …/nptl/pthread\_mutex\_lock.c:115: \_\_pthread\_mutex\_lock: Assertion `mutex-\>\_\_data.\_\_owner == 0’ failed.

Thread 13 “as\_main\_single\_” received signal SIGFPE, Arithmetic exception.

[Switching to Thread 0x7fffc9ffe700 (LWP 9890)] 0x0000555555580be3 in as\_queue\_get (queue=0x555555cdd3b8, queue=0x555555cdd3b8, queue=0x555555cdd3b8, index=) at modules/common/target/Linux-x86\_64/include/aerospike/as\_queue.h:158 158 modules/common/target/Linux-x86\_64/include/aerospike/as\_queue.h: No such file or directory. (gdb) bt

#0 0x0000555555580be3 in as\_queue\_get (queue=0x555555cdd3b8, queue=0x555555cdd3b8, queue=0x555555cdd3b8, index=) at modules/common/target/Linux-x86\_64/include/aerospike/as\_queue.h:158

#1 as\_queue\_pop (ptr=0x7fffc9ffcab0, queue=0x555555cdd3b8) at modules/common/target/Linux-x86\_64/include/aerospike/as\_queue.h:171

#2 as\_conn\_pool\_pop\_head (sock=0x7fffc9ffcab0, pool=0x555555cdd390) at src/include/aerospike/as\_conn\_pool.h:76

#3 as\_node\_get\_connection (err=err@entry=0x7fffc9ffda70, node=node@entry=0x555555ccfbd0, socket\_timeout=330, deadline\_ms=1713350659, sock=sock@entry=0x7fffc9ffcb80) at src/main/aerospike/as\_node.c:519

#4 0x000055555556fffe in as\_command\_execute (cmd=cmd@entry=0x7fffc9ffcd30, err=err@entry=0x7fffc9ffda70) at src/main/aerospike/as\_command.c:527

#5 0x00005555555663d2 in as\_batch\_execute\_keys (btk=btk@entry=0x7fffc9ffd510, err=err@entry=0x7fffc9ffda70, parent=parent@entry=0x0) at src/main/aerospike/aerospike\_batch.c:740

#6 0x0000555555569866 in as\_batch\_keys\_execute (as=, err=0x7fffc9ffda70, policy=, batch=, read\_attr=read\_attr@entry=3, bins=bins@entry=0x0, n\_bins=, n\_bins@entry=0, callback=, callback\_xdr=, callback\_xdr@entry=0x0, udata=) at src/main/aerospike/aerospike\_batch.c:1004

#7 0x000055555556ac7e in aerospike\_batch\_get (as=, err=, policy=, batch=, callback=, udata=) at src/main/aerospike/aerospike\_batch.c:1940 #8 0x000055555556160a in play\_batch\_once\_sync () at as\_main\_single\_async\_get.c:315 #9 0x000055555556299a in run\_all\_waves (arg=0x5) at as\_main\_single\_async\_get.c:579 #10 0x00007ffff7bbd6db in start\_thread (arg=0x7fffc9ffe700) at pthread\_create.c:463 #11 0x00007ffff6beca3f in clone () at …/sysdeps/unix/sysv/linux/x86\_64/clone.S:95 (gdb)

Before I added these lines, the code was good

```
    g_as_config.conn_pools_per_node = 400;
    g_as_config.min_conns_per_node = 400;
    g_as_config.max_conns_per_node = 400;

```

---

<div class="post-metadata">

**Author:** ![Brian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brian/32/2211_2.png) [@Brian](https://discuss.aerospike.com/u/Brian)\
**Post date:** [September 1, 2020, 5:20pm UTC](https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793/2 "2020-09-01T17:20:38Z")

</div>

You have configured 400 connection pools for every node. This means each connection pool manages a single connection (which does not make sense). conn\_pools\_per\_node should usually be left at the default (1) and rarely ever set to more than 5.

---

<div class="post-metadata">

**Author:** ![vikrantl](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vikrantl](https://discuss.aerospike.com/u/vikrantl)\
**Post date:** [September 1, 2020, 7:36pm UTC](https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793/3 "2020-09-01T19:36:45Z")

</div>

Thanks Brian for the inputs.

I am also trying async calls.

I have 400 application threads

From each thread I am firing aerospike\_key\_get\_async for 4 keys

And then doing a common wait

The aerospike cluster server is a 3 node cluster, with 2 way replication.

Could you please give me a good formula to calculate

**uint32\_t as\_config::async\_max\_conns\_per\_node**

**uint32\_t as\_config::async\_min\_conns\_per\_node**

**uint32\_t as\_config::conn\_pools\_per\_node**

**event\_loops required for as\_create\_event\_loops()**

The documentation is good, but this combination will need some more advice.

thanks

-Vikrant

---

<div class="post-metadata">

**Author:** ![Brian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brian/32/2211_2.png) [@Brian](https://discuss.aerospike.com/u/Brian)\
**Post date:** [September 2, 2020, 12:18am UTC](https://discuss.aerospike.com/t/exception-in-aerospike-batch-get-c-client-lib-4-6-17/7793/4 "2020-09-02T00:18:44Z")

</div>

**event\_loops required for as\_create\_event\_loops()**

Create one event loop for every cpu core.

**uint32\_t as\_config::conn\_pools\_per\_node**

Leave at default (1). Async commands do not use conn\_pools\_per\_node.

**uint32\_t as\_config::async\_max\_conns\_per\_node**

**uint32\_t as\_config::async\_min\_conns\_per\_node**

1600 (400 \* 4) concurrent commands requires 1600 concurrent connections. This is way too many concurrent commands. You will need to set `as_policy_event.max_commands_in_process` to something reasonable like 40 per event loop. Then set `async_max_conns_per_node` to (40 \* {number of event loops}).
