Hi,

I'm using riakc_pb_socket to queue up several requests and rely on the
built-in queueing, which should hopefully eventually service all requests.
However I have a scenario in which a couple processes that queue a request
are never terminating the call on the socket...even though a request issued
subsequently gets through.

I have one process which quickly spawns 7 processes, each of which will
call riakc_pb_socket:search. 6 of these requests should return 0 results
quickly. 1 returns 85000 results. What I see happen frequently (but not
always) is that 4 of the requests with 0 results will complete. Then the
long request with all the results eventually completes ( I set a high
enough timeout value). After this, the 2 other requests never seem to get
executed.

-record(state, {riak_conn,
       ...}).

handle_info({add_platform, PlatformBin}, State) ->
...
    erlang:spawn(?MODULE, populate_instance, [PlatformBin, State]),
...

populate_instance(InstanceBin, State) ->
    error_logger:info_msg(binary_to_list(InstanceBin) ++ " about to wait"),
    MapredResult = riakc_pb_socket:search(State#state.riak_conn,
                      InstanceBin,
                      "type:account",
                      [{map, {jsanon, <<"
function(v, keyData, arg) {
    var o = JSON.parse(v.values[0].data);
    var p = {...}; // I'm transforming the object
    return [JSON.stringify(p)]
}">> }, none, true }],
                      90000), % timeout
    error_logger:info_msg(binary_to_list(InstanceBin) ++ " done waiting"),

    .... process MapredResult ...


In the log I get 7 lines from populate_instance like this:
1c837b206ff37939892740206c8eb4f0f897b282 about to wait

Then I get 4 lines like this:
1c837b206ff37939892740206c8eb4f0f897b282 done waiting

Then it gets to the 5th one with a lot of results. Eventually:
a65796222ea26bb7b355bf140dbd5b72e81efee1 done waiting

Then no more. The remaining 2 processes in riakc_pb_socket:search never
seem to print "... done waiting".

Suppose I sneak in a request to add a platform:
list_to_pid("<0.120.0>") ! {add_platform, <<"aaa">>}.

I see in the log that it goes through:
aaa about to wait
aaa done waiting

...so it seems like my 2 processes will never finish.

Any ideas? It seems like it should be fine to pass State to different
processes, since the connection is just a pid. The queue is sitting in the
socket process and should be fine.
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to