[erlang-questions] Cannot use io:format() in a handle_call() callback in an application?

Erik Søe Sørensen eriksoe@REDACTED
Thu Jul 3 09:54:20 CEST 2014


This is a long shot, but... you don't happen to have a module called 'user'
or 'group' lying around in your app, do you?
/Erik
Den 03/07/2014 09.42 skrev "Calle Dybedahl" <calle@REDACTED>:

> Hi there.
>
> I've just run into a bit of behavior that I do not understand: if I have
> an io:format() in a handle_call, I get a timeout instead of a return from
> gen_server:call(), but only if the gen_server module was started as part of
> an application. I ran into it while trying to do something real, but it's
> easy enough to reproduce in a clean environment.
>
> So. I start with an application created with "rebar create-app appid=wtf"
> and "rebar create template=simplesrv srvid=wtf", and the wtf module added
> as a child of the supervisor. If I then do "application:start(wtf)." in a
> shell, "gen_server:call(wtf,something)." returns "ok" as expected. If I now
> add the single line "io:format("In handle_call.~n")," at the start of
> wtf:handle_call(), and try to run the same two commands, instead of "ok" I
> get a pause followed by:
>
> ** exception exit: {timeout,{gen_server,call,[wtf,something]}}
>      in function  gen_server:call/2 (gen_server.erl, line 182)
>
> I totally don't understand why this happens, and only when it was started
> with "application:start(wtf)". If I start either the wtf_sup or wtf modules
> manually, the io:format() runs and prints what it should without problems.
>
> I'm using Erlang 17.1 (installed with Homebrew) under OSX 10.9.
> --
> Calle Dybedahl -*- calle@REDACTED
>
> _______________________________________________
> 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/20140703/0dd6b294/attachment.htm>


More information about the erlang-questions mailing list