Sync gateway POST /db/ requests time out but the document is created

I have a weird issue where I make about 20 concurrent calls to SG instance and a lot of calls just hang. I have a timeout for these requests set to 10s and I get timeout event triggered very often. What is bizarre is that that document is actually created in Couchbase but SG never responds back.

It’s a very small testbox (OpenVZ, Ubuntu, 5Gb RAM and 1GHz CPU) so I’d expect things to be very slow but not hanging requests. It never happens that all my requests hang but 15-19 at a time. Also 20 concurrent requests is not that much and it works fine speed wise but with this very weird issue.

SG 3.0.4

Are you able to post the relevant part of the logs to help us see more of what is going on?

I’ve just rerun it trying to find any meaninful logs but I don’t see any. My calls just fail with TimeoutException, sync_gateway log is totally fine and is full of

13:59:42.149228 HTTP:  #053: POST /bucket/  (ADMIN)

couchbase logs don’t seem to be useful neither. I do see this in error.log:

[stats:error,2015-04-15T13:58:30.694,ns_1@127.0.0.1:<0.14993.3>:stats_collector:handle_info:124]Exception in stats collector: {exit,
                                  {{badmatch,{error,closed}},
                                   {gen_server,call,
                                       ['ns_memcached-bucket',
                                        {stats,<<>>},
                                        180000]}},
                                  [{gen_server,call,3,
                                       [{file,"gen_server.erl"},{line,188}]},
                                   {ns_memcached,do_call,3,
                                       [{file,"src/ns_memcached.erl"},
                                        {line,1399}]},
                                   {stats_collector,grab_all_stats,1,
                                       [{file,"src/stats_collector.erl"},
                                        {line,84}]},
                                   {stats_collector,handle_info,2,
                                       [{file,"src/stats_collector.erl"},
                                        {line,116}]},
                                   {gen_server,handle_msg,5,
                                       [{file,"gen_server.erl"},{line,604}]},
                                   {proc_lib,init_p_do_apply,3,
                                       [{file,"proc_lib.erl"},{line,239}]}]}

[ns_server:error,2015-04-15T13:58:31.075,ns_1@127.0.0.1:ns_doctor<0.314.0>:ns_doctor:update_status:229]The following buckets became not ready on node 'ns_1@127.0.0.1': ["bucket"], those of them are active ["bucket"]

but it’s only once and a number of Timeouts is much greater. I’m wondering if it’s something related to sync_gateway running in OpenVZ instance. Single requests work fine but it happens when I start sending concurrent requests. and 20 requests is not that much.