[erlang-questions] Problem with io:fwrite/2 ?

Gustav Simonsson gustav.simonsson@REDACTED
Fri May 28 10:46:38 CEST 2010


Hard to say without knowing how your CL#'CallLog'.file implements the Erlang IO protocols,
does it always reply on the form {io_reply, ReplyAs, Reply}?
Thing is, the main receive clause in wait_io_mon_reply(From, Mref) in stdlib/io.erl waits
for either a io_reply or an exit/down message, so it could potentially hang there if
your CL#'CallLog'.file is not correctly implemented.

BR,
Gustav Simonsson


----- Original Message -----
From: "Steven Gardell" <sgardell@REDACTED>
To: erlang-questions@REDACTED
Sent: Thursday, 27 May, 2010 19:01:02 GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: [erlang-questions] Problem with io:fwrite/2 ?

Running R13B04 under Linux RES 4. 
It seems that io:fwrite/2 is hanging "most of the time." With the
following code segment:
 
  io:format("BEFORE FULL WRITE~n"),
    io:fwrite(CL#'CallLog'.file,
        "Calls: ~w Rate: ~w Trans: ~w %SlowAdd: ~.1f %SlowMod: ~.1f
%SlowOther ~.1f %SlowTotal ~.1f %Slow2: ~.1f %Slow3: ~.1f Failed ~w
Unexpected: ~w~n",
        [CL#'CallLog'.callCount,
        Rate,
        CL#'CallLog'.transCount,
        SlowAdd1,
        SlowMod1,
        SlowOther1,
        SlowTotal1,
        SlowTotal2,
        SlowTotal3,
        CL#'CallLog'.failedCount,
        CL#'CallLog'.unexpectedMsg]),
 
    io:format("BEFORE EMPTY LINE~n"),
    io:fwrite(CL#'CallLog'.file,"~n"),
    io:format("AFTER EMPTY LINE~n").
 
I see:
 
1> LOADTEST: Ready
loadtest:onecall(twoterm4trans).
Test: 5/27/2010 12:47:36 Rate: 1 Hold: 1 Calls:1
{go,1,1,0,1,1,twoterm4trans}
BEFORE FULL WRITE
BEFORE EMPTY LINE
2>

The subsequent behavior of the program leads me to believe
we never returned from fwrite().


More information about the erlang-questions mailing list