[erlang-questions] spawn/4 problem

Serge Aleynikov <>
Fri Mar 9 13:23:34 CET 2007


You can only use erlang:is_process_alive/1 for Pids on a local node.  In 
your case the Pid is on a different node.  If you really need to call 
that function use rpc:

rpc:call(Node, erlang, is_process_alive, [Pid]).

Serge

 wrote:
>  
> Hi ,
>  
> I've developed an application which uses spawn/4 .But at some instances
> the pid returned by it is a dummy one i.e. that pid does not exist in
> reality.(i checked it using pman:start().  ). Due to this ,  my
> application is going into a hanged state  i.e it is sending some message
> o the spawned process but not getting any response from it .It is simply
> waiting for the response .
>  
> Could anyone please tell me how I can check whether the pid is real one
> or just a dummy ?
> Also how can I trap the exit signal sent by spawn/4 ? 
>  
> Also , when I execute this line in the erl prompt it is working fine but
> when I include it in a file I 'm getting the error .
>          Pid = spawn('', my_file, start, []),
>          erlang:is_process_alive(Pid),
> The above works  well in erl  prompt but gives the following error when
> included in the file 
>          =ERROR REPORT==== 9-Mar-2007::14:05:19 ===
> Error in process <0.30.0> on node '' with exit value:
> {badarg,[{erlang,is_process_alive,[<5064.11526.6>]},{erl_eval,do_apply,5
> },{shell,eval_loop,2}]}
>  
> ** exited: {badarg,[{erlang,is_process_alive,[<5064.11526.6>]},
>                     {erl_eval,do_apply,5},
>                     {shell,eval_loop,2}]} **
>   
>  
> Thanks in advance .
>  
> Regards ,
> Vikash
> 
> 
> 
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>  
> www.wipro.com
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list