[erlang-questions] Question about http client

mats cronqvist <>
Thu Apr 16 23:11:52 CEST 2009


mtalyans <> writes:

> Hi All,
>
> I am a rank beginner, so please bear with me:
>
> I am fetching Web content from a set of URLs using http:request. For
> most of URLs everything works fine; however for some of them I see
> error reports on the console that look like so:

... tons of crap...

> ** Reason for termination ==
> ** session_remotly_closed
>
> As far as I can tell, session has been remotely closed.

  that is indeed what's happening.

>  I don’t mind a failure like this, but I would like to get rid of
> the error reports, as I am fetching many, many URLs.

  it is a bizarre design decision to print an error report for a
  perfectly normal event. there has been some complaining about this
  on erlang-bugs (by me among others) to no avail.

  The only sane solution (turning off sasl is insane) I've been able
  to come up with is to patch; IIRC you have to replace the atom
  'session_remotly_closed' with 'shutdown' in a few lines like this;

httpc_handler.erl:    {stop, session_remotly_closed, State};

> In other cases, I get content properly fetched, and then get an error report
> with a timeout:
>
> <0.49.0> spawned pid <0.50.0>
> <0.50.0>: normal clause "Normal completion"
>
> =ERROR REPORT==== 15-Apr-2009::13:35:05 ===
> ** Generic server <0.51.0> terminating
> ** Last message in was {timeout,#Ref<0.0.0.67>}
> ** When Server state == {state,undefined,
>                             {tcp_session,
>                                 {{"links.preplogic.com",80},<0.51.0>},
>                                 false,http,#Port<0.1570>,1,keep_alive},
>                             undefined,undefined,undefined,undefined,
>                             {[],[]},
>                             {[],[]},
>                             keep_alive,[],nolimit,nolimit,
>                             {options,
>                                 {undefined,[]},
>                                 0,2,5,120000,2,disabled,enabled,false},
>                             {timers,[],#Ref<0.0.0.78>},
>                             httpc_manager,undefined}
> ** Reason for termination ==
> ** {{badrecord,request},
>     [{httpc_handler,handle_info,2},
>      {gen_server,handle_msg,5},
>      {proc_lib,init_p_do_apply,3}]}
>
> Could someone in the know help me to solve this issue?


  this looks like a "real" bug. handle_info/2 expects a to be handed a
  record, but it gets an atom, namely 'request'. This will happens if
  you type 'request' instead of 'Request' at the right place...

  I'll CC this to erlang-bugs, in case the OTP guys miss it.

  mats



More information about the erlang-questions mailing list