[rabbitmq-discuss] Creating an auth plugin (Kerberos)

Simon Lundström simlu at su.se
Thu Nov 15 07:22:38 GMT 2012


On Tue, 2012-11-13 at 17:21:19 +0000, Simon MacMullen wrote:
> On 13/11/12 14:35, Simon Lundström wrote:
> >>So make sure to receive that message in your plugin...
> >
> >In my receive, here
> ><https://github.com/simmel/rabbitmq-auth-backend-kerberos/blob/213a831a61e1524cb187273b7d78ff5bc415a678/src/rabbit_auth_backend_kerberos.erl#L42-55>,
> >I tried to add:
> >
> >     {'EXIT', Port, PosixCode} ->
> >       rabbit_log:error("EXIT: ~p~n", [PosixCode]),
> >       false;
> >
> >however I still get the same error.
> >I even tried to add:
> >     {A, B, C} ->
> >       rabbit_log:error("EXIT: ~p : ~p : ~p~n", [A,B,C]),
> >       false;
> >
> >just to see so I could "catch" every case but I still got the same error.
> 
> You don't want to add that message to the existing receive block -
> since you will receive the {Port, {exit_status, A}} message as well,
> and you'll only receive one message per receive block. So you need a
> second block after the first to receive the 'EXIT' message.

Aaah, of course! As I've said (a few times now), I'm new to functional
(and sort of new to event driven) programming.

In my code which I created before I put it in the module I had a loop
which iterated over receive, is this the prefered solution?

See
<https://github.com/simmel/rabbitmq-auth-backend-kerberos/commit/a111b1aaf7289e8f02a6a591722a5593e649b354>

> >Since the crash report mentions a supervisor I suspected it had
> >something to do with "my" sup in
> 
> No, not at all. The crash report mentions a supervisor since pretty
> much all crash reports do - the supervisor *for the reader* detected
> that the reader had crashed.
> 
> After all, that's what supervisors are for.

Still new to Erlang and it's stacktraces, but since I've "created" my
own supervisor how come it isn't mentioned in the stacktrace? Or is "my"
supervisor just a shim of sorts?

> ><https://github.com/simmel/rabbitmq-auth-backend-kerberos/blob/213a831a61e1524cb187273b7d78ff5bc415a678/src/rabbit_auth_backend_kerberos_app.erl>
> >so I tried to add this to the start function:
> >   receive
> >     {'EXIT', Port, PosixCode} ->
> >       rabbit_log:error("EXIT in sup: ~p~n", [PosixCode]),
> >       false
> >   end.
> >
> >but RabbitMQ wouldn't even start and didn't log anything anywhere then = D
> 
> Well yes, at that point you're in the application startup; you
> haven't opened the port yet. Also you haven't specified a timeout
> this time, so your application hangs waiting for this message to
> arrive.

Ah, of course.

Thanks alot!
- Simon


More information about the rabbitmq-discuss mailing list