'Bad Connection Handle' for Aerospike

I tried to integrate the Aerospike with Ejabberd, and after little bit of struggle and I had hit another issue which says

" DEBUG:[util_extract_common_lead_parms()]:Connection Handle is bad C(0) DEBUG:[util_extract_common_lead_parms()]:Connection Handle is bad C(32680) " I made the connection the following way,

-define(CONN_NAME, 'ejabberd_aerospike_client').
   Host = "", 
   Port = 3000,
  case aerospike:connect( Host, Port ) of
  {ok, C } ->
{error, _} = Err ->
  ?ERROR_MSG("failed to start aerospike client: ~p", [Err]),

Can you validate whether or not the example(s) which comes with erlang client successfully run against your server?

Yes, they(examples) did worked well as standalone. The module which I wrote for Ejabberd to connect with clues from Examples didnt work and throws this exception.

I tried couple of ways to make it work. And finally the root cause is,


is failing with bad argument. but the same register will work if i give like


W.r.t aerospike if I create a fresh connection for each insertion it worked (its a overkill). You can give a try for this on ‘helloWorld.erl’ by yourself.

Is this a bug in the erlang driver or am I missing some some good practice (as I’m new to this erlang world) which I have to take care of.

Awaiting for response.

From the Erlang documentation, the register/2 function will only take valid pid or port number. http://erlang.org/doc/man/erlang.html#register-2

The cluster object C returned by aerospike:connect() is an opaque object.

You are correct in seeking a way to only create the cluster object only once, and reuse it subsequently on all aerospike calls. Knowledge of doing this in the ejabberd environment is likely best found with experts in that community.