Get a new lb pid if existing pid is not alive

It's possible for the connection process associated with a pid in the
ibrowse_lb ets table to die, yet remain in the table, in which case
subsequent requests to the corresponding {Host, Port} will result in an
error like the following:

(node1@127.0.0.1)9> ibrowse:send_req("http://localhost:15984", [], get).
                ** exception exit: {noproc,
                       {gen_server,call,
                           [<0.2451.0>,
                            {spawn_connection,
                                {url,"http://localhost:15984","localhost",15984,
                                    undefined,undefined,"/",http,hostname},
                                10,10,
                                {[],false},
                                []}]}}
     in function  gen_server:call/2 (gen_server.erl, line 215)
     in call from ibrowse:try_routing_request/14 (src/ibrowse.erl, line 377)

This checks whether the pid about to be returned from the table is alive,
and if not, the entry is deleted, and a new pid is obtained.
2 files changed
tree: 53726f2081c74778403809235c442aa43f6da94f
  1. include/
  2. src/