Erlang Mailing Lists

Author Message

<  Erlang questions mailing list  ~  exiting with badarg && Erlang Web server

cesarini at erlang.ericss
Posted: Sun Jun 13, 1999 9:48 am Reply with quote
Guest
The only bad arg I can see occur here (You unfortunately provided too
little of the code) is if you are attempting to send a message to a
registered process which does not exist.

* Has chat_server been started, and has the process been registered?
* If you have spawned a process, has it crashed? (These suckers tend to
die silently.)

Check it out by using the BIF registered().

Eddie is the fault tollerant distributed web server. You can download it
from http://www.eddieware.org

Rgds,
Francesco

lyn wrote:
>
> I'm trying to diagnose an error message and I wonder if
> anything immediately jumps out at the experts. here is the
> shell interaction:
>
> 55> chat_client:signup().
> ** exited: {badarg,{chat_client,signup,[]}} **
>
> =ERROR REPORT==== 12-Jun-1999::23:29:29 ===
> !!! Error in process <0.144.0> with exit value:
> {badarg,{chat_client,signup,[]}}
>
> I assume this means that chat_client doesn't contain a zero
> argument function called signup. But chat_client.erl contains this:
>
> signup() ->
> chat_server ! {sign_up, name(), self()},
> receive {ok, Pid} ->
> io:format("signup succeeded"),
> chat_client_dispatch(name())
> after 5 ->
> failed
> end.
>
> so where is this bad match occurring?
>
> thanks,
> -Lyn

===========================================================================
Francesco Cesarini Phone: +46 8 719 56 97
Fax: +46 8 719 89 40
Erlang Systems Cellular: +46 70 563 04 36
Torshamnsgatan 39 B
Box 1214 http://www.ericsson.se/erlang
S-164 28 KISTA, SWEDEN cesarini_at_erlang.ericsson.se
============================================================================



Post generated using Mail2Forum (http://m2f.sourceforge.net)
ulf.wiger at etxb.ericsso
Posted: Mon Jun 14, 1999 9:38 am Reply with quote
Guest
Francesco Cesarini wrote:
>
> The only bad arg I can see occur here (You unfortunately provided too
> little of the code) is if you are attempting to send a message to a
> registered process which does not exist.
>
> * Has chat_server been started, and has the process been registered?
> * If you have spawned a process, has it crashed? (These suckers tend to
> die silently.)

They die silently if they have been started with spawn(M,F,A).
This is a feature, BTW, since clear error reporting *is* a bit
expensive.

There are ways to get more error reports from process termination:

1. Use spawn_link(M,F,A) instead of spawn/3.
--------------------------------------------
In this case the parent process will receive a message, {'EXIT',
Reason}, when the child process dies. If the parent doesn't trap exits,
it'll die and you'll probably notice.

Example:

$> erl -boot start_clean
Erlang (BEAM) emulator version 4.8.2.1

Eshell V4.8.2.1 (abort with ^G)
1> spawn_link(foo,bar,[]).
<0.30.0>
** exited: {undef,{foo,bar,[]}} **


2. Use the proc_lib equivalents to spawn/3 and spawn_link/3.
------------------------------------------------------------
The module proc_lib will do the same thing as spawn/3 and spawn_link/3,
but will trap its own exits and generate an error report before exiting.
To see the crash reports, you must start SASL (unless you have your own
error reporting mechanism.)

Example:

(No error reporting if you don't start SASL)

etxuwig_at_avc343 > erl -boot start_clean
Erlang (BEAM) emulator version 4.8.2.1

Eshell V4.8.2.1 (abort with ^G)
1> proc_lib:spawn(foo,bar,[]).
<0.30.0>
2>

(Progress, Error and Crash reports with SASL)

$ > erl -boot start_sasl
...
=PROGRESS REPORT==== 14-Jun-1999::11:30:22 ===
application: sasl
started_at: nonode_at_nohost

1> proc_lib:spawn(foo,bar,[]).
<0.39.0>
2>
=CRASH REPORT==== 14-Jun-1999::11:30:35 ===
crasher:
pid: <0.39.0>
registered_name: []
error_info: {undef,{foo,bar,[]}}
initial_call: {foo,bar,[]}
ancestors: [<0.25.0>]
messages: []
links: []
dictionary: []
trap_exit: false
status: running
heap_size: 233
stack_size: 0
reductions: 74
neighbours:


/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum