# Work with two clusters at the same time

**URL:** <https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240>\
**Category:** C Client Library\
**Created:** [August 16, 2014, 12:40am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240 "2014-08-16T00:40:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clairerospike](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/clairerospike/32/30_2.png) [@Clairerospike](https://discuss.aerospike.com/u/Clairerospike)\
**Post date:** [August 16, 2014, 12:40am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240/1 "2014-08-16T00:40:42Z")

</div>

Postby Slader » Mon Sep 30, 2013 2:34 pm

I use Aerospike 3 Community Edition. And C driver. Ubuntu 12.04. I would like to connect and operate two (or more) clusters at the same time. Using C API i connect to two clusters without any errors. But when I try to put or get records I can do it only with first cluster. And when I try to put/get data to second cluster i have got core dump:

```
Program terminated with signal 11, Segmentation fault.
#0 __pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
50 pthread_mutex_lock.c: No such file or directory.
(gdb) bt
#0 __pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
#1 0x000000000042b418 in cl_cluster_node_get (asc=0x0, ns=0x7fff77fc95a1 "users", d=0x7fff77fc9300, write=true) at src/main/citrusleaf/cl_cluster.c:738
#2 0x000000000042716f in do_the_full_monte (asc=0x0, info1=<optimized out>, info2=<optimized out>, info3=<optimized out>, ns=0x7fff77fc95a1 "users", set=<optimized out>, key=0x0, digest=0x7fff77fc9631, values=0x7fff77fc93c8,
    operator=CL_OP_WRITE, operations=0x0, n_values=0x7fff77fc93c4, cl_gen=0x0, cl_w_p=0x7fff77fc9470, trid=0x7fff77fc93d8, setname_r=0x0, call=0x0, cl_ttl=0x0) at src/main/citrusleaf/citrusleaf.c:1413
#3 0x0000000000428291 in citrusleaf_put_digest_with_setname (asc=<optimized out>, ns=<optimized out>, set=<optimized out>, digest=<optimized out>, values=0x7fff77fc9400, n_values=1, cl_w_p=0x7fff77fc9470)
    at src/main/citrusleaf/citrusleaf.c:1711
#4 0x0000000000418ec4 in aerospike_key_put (as=0x7fff77fcc1b8, err=0x7fff77fce6d8, policy=<optimized out>, key=0x7fff77fc95a0, rec=<optimized out>) at src/main/aerospike/aerospike_key.c:372
#5 0x0000000000413915 in Aerospike::set (this=0x7fff77fcc1b0, set=..., key=..., bin=..., value=...) at /home/slader/projects/utils/as-test/src/Aerospike.cpp:102
#6 0x0000000000414186 in main () at /home/slader/projects/utils/as-test/src/main.cpp:48Program terminated with signal 11, Segmentation fault.
#0 __pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
50 pthread_mutex_lock.c: No such file or directory.
(gdb) bt
#0 __pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
#1 0x000000000042b418 in cl_cluster_node_get (asc=0x0, ns=0x7fff77fc95a1 "users", d=0x7fff77fc9300, write=true) at src/main/citrusleaf/cl_cluster.c:738
#2 0x000000000042716f in do_the_full_monte (asc=0x0, info1=<optimized out>, info2=<optimized out>, info3=<optimized out>, ns=0x7fff77fc95a1 "users", set=<optimized out>, key=0x0, digest=0x7fff77fc9631, values=0x7fff77fc93c8,
    operator=CL_OP_WRITE, operations=0x0, n_values=0x7fff77fc93c4, cl_gen=0x0, cl_w_p=0x7fff77fc9470, trid=0x7fff77fc93d8, setname_r=0x0, call=0x0, cl_ttl=0x0) at src/main/citrusleaf/citrusleaf.c:1413
#3 0x0000000000428291 in citrusleaf_put_digest_with_setname (asc=<optimized out>, ns=<optimized out>, set=<optimized out>, digest=<optimized out>, values=0x7fff77fc9400, n_values=1, cl_w_p=0x7fff77fc9470)
    at src/main/citrusleaf/citrusleaf.c:1711
#4 0x0000000000418ec4 in aerospike_key_put (as=0x7fff77fcc1b8, err=0x7fff77fce6d8, policy=<optimized out>, key=0x7fff77fc95a0, rec=<optimized out>) at src/main/aerospike/aerospike_key.c:372
#5 0x0000000000413915 in Aerospike::set (this=0x7fff77fcc1b0, set=..., key=..., bin=..., value=...) at /home/slader/projects/utils/as-test/src/Aerospike.cpp:102
#6 0x0000000000414186 in main () at /home/slader/projects/utils/as-test/src/main.cpp:48

```

---

<div class="post-metadata">

**Author:** ![Clairerospike](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/clairerospike/32/30_2.png) [@Clairerospike](https://discuss.aerospike.com/u/Clairerospike)\
**Post date:** [August 16, 2014, 12:40am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240/2 "2014-08-16T00:40:57Z")

</div>

Post by young » Thu Oct 03, 2013 4:26 pm

Thank you for your post. We recently found a bug in this implementation and are working on a fix for this now. Please check back in the next release for the fix.

---

<div class="post-metadata">

**Author:** ![Clairerospike](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/clairerospike/32/30_2.png) [@Clairerospike](https://discuss.aerospike.com/u/Clairerospike)\
**Post date:** [August 16, 2014, 12:41am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240/3 "2014-08-16T00:41:13Z")

</div>

Post by sumeetjain » Tue Oct 08, 2013 10:31 am

Hi Young,

Can you please elaborate on the bug, and an estimated timeline of when it will be fixed?

I’m running into the identical stack trace (a segmentation fault in pthread\_mutex\_lock), but only connecting to a single cluster.

Also, I’m able to put/get records for some sets, but seeing the segfault for others.

Thanks, Sumeet

---

<div class="post-metadata">

**Author:** ![Clairerospike](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/clairerospike/32/30_2.png) [@Clairerospike](https://discuss.aerospike.com/u/Clairerospike)\
**Post date:** [August 16, 2014, 12:41am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240/4 "2014-08-16T00:41:43Z")

</div>

Pos tby young » Wed Oct 09, 2013 10:47 am

We are actively working on the fix and it should roll out with the next release. I am not sure about the exact time.

We have not seen the other segfaults your are referring to. Perhaps the fix we put out will fix this as well.

---

<div class="post-metadata">

**Author:** ![wchu](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@wchu](https://discuss.aerospike.com/u/wchu)\
**Post date:** [August 16, 2014, 12:47am UTC](https://discuss.aerospike.com/t/work-with-two-clusters-at-the-same-time/240/5 "2014-08-16T00:47:27Z")

</div>

This issue is now fixed.

Please make sure you have client version 3.0.34 or above

[http://www.aerospike.com/download/client/c/notes.html#3.0.72](http://www.aerospike.com/download/client/c/notes.html#3.0.72)
