[erlang-questions] poolboy new_worker failed cause poolboy crashed

José Valim jose.valim@REDACTED
Tue Apr 14 10:49:12 CEST 2015


You don't need to modify eredis per se. You can create a worker that is
between poolboy and eredis that tracks the connected/disconnected semantics
as Devin described. Unfortunately I don't know of any sample Erlang code
but, if you don't mind, here is a similar solution using redo written in
Elixir:

https://github.com/phoenixframework/phoenix/blob/master/lib/phoenix/pubsub/redis_conn.ex

To use it, you checkout the worker above from the pool, ask the redis
connection to the worker and do the operations you want to in the
connection as usual.

As a note, I did find it a bit weird that eredis handles disconnects
automatically but it does not handle the case where it can't connect to
Redis on start_link. It would be handful if they supported lazy connections
(i.e. don't connect on start_link but on first command). They already have
all the code to handle this, it is just a matter of supporting it on
start_link too.



*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Lead Developer

On Tue, Apr 14, 2015 at 10:26 AM, linbo liao <llbgurs@REDACTED> wrote:

> Hi,
>
> I open an issue for poolboy (https://github.com/devinus/poolboy/issues/72),
> but looks author doesn't think this is an issue.
>
> Looks like to solve this issue have two ways:
>
> 1. Modify eredis client,  start_link still return ok when connect failed,
> and when use it should check eredis socket alive or not
>
> 2. Modify poolboy library, protected all logic when call new_worker failed.
>
> But it require change ereids or poolboy code, I was wondering to know
> anyone hit this issue, how to resolve it?
>
> Thanks,
> Linbo
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150414/1af18dbb/attachment.htm>


More information about the erlang-questions mailing list