[erlang-questions] Common test 1.7.X gen_server call noproc in init_per_group

Motiejus Jakštys desired.mta@REDACTED
Thu Nov 21 17:41:18 CET 2013


On Thu, Nov 21, 2013 at 5:23 PM, Tien Le <letien83@REDACTED> wrote:
> Yes, that's what I thought too. That's why I try to start it again in my
> init_per_group. My code looks similar like this:
>
> init_per_group(_Group, Config) ->
>       case whereis(?SERVER) of
>               undefined ->
>                         my_server:start();
>               _Pid ->
>                         ok
>       end,
>       my_server:do(...),
>       Config.
>
> I can see some printout that the server is started again, but I still get
> exit:{noproc, ... execption when I call my_server:do(...)

is my_server:start() a synchronous operation? I.e. are you sure that
when it returns, the server is up and running?

if you are not sure, try doing a gen_server:call to it right after
start, and see if it fixes the situation.

>
> I switch to OTP R15B03 in which it includes Common Test 1.6.X, and it is
> fine.

If start is asynchronous, the reason might be different scheduler
behavior (which changed quite a bit in R15->R16).

Motiejus



More information about the erlang-questions mailing list