http:request returns {error, session_remotly_closed}

Bertil Karlsson bertil.karlsson@REDACTED
Thu Mar 2 10:03:37 CET 2006


There is a debug option you can use on the client, so far undocumented 
and a bit ugly printouts, but you will get something that may help 
debugging. It prints what the client sends and receives. Before your 
request do: http:set_options([verbose]).

/Bertil


Soren Gronvald wrote:

>Thanks for replies. 
>
>I can make it work with ibrowse, but I still have the
>problem with http:request even when I do asynch. 
>
>I found an earlier discussion from may 2005 about a
>similar problem:
>
>  
>
>>I am not a 100 % sure but I think that your problem
>>could be related
>>to a pipeline bug that we fixed just recently. The
>>bug manifested
>>itself by returning {error, session_remotly_closed}
>>    
>>
>for a request
>  
>
>>that the manager wrongly tried to pipeline.
>>    
>>
>
>  
>
>>-- 
>>/Ingela - OTP team
>>    
>>
>
>
>http://www.erlang.org/ml-archive/erlang-questions/200505/msg00237.html
>
>Any one knows if this fix got into open source erlang,
>and what it was?
>
>Regards
>Gronvald
>
>
>--- Stephen Han <kruegger@REDACTED> wrote:
>
>  
>
>>I ran your sample under Windows XP service pack 2
>>with OTP R10B-9.
>>I could not reproduce the problem.
>>
>>One of my application do http:request every 5
>>minutes. It has been doing
>>that since 2005 June. So far didn't see that error
>>since. But mine do
>>http:request every 5 min so yours probably do it
>>really fast without
>>interval.
>>
>>I think it may be the persistent connection that
>>confuses whoever that is,
>>http module or web server. :-)
>>
>>Try asynchronously and see if happens again.
>>
>>regards,
>>
>>
>>On 2/26/06, Soren Gronvald <gronvald@REDACTED>
>>wrote:
>>    
>>
>>>hi,
>>>
>>>I have a problem with http:request that I think
>>>      
>>>
>>could
>>    
>>
>>>be a bug (but of course it could be due to
>>>      
>>>
>>ignorance
>>    
>>
>>>on my part).
>>>
>>>I am trying to read a url from yahoo.com in the
>>>simplest possible way - http:request(Url)- but it
>>>fails with the error
>>>
>>>{error,session_remotly_closed}
>>>
>>>This of course indicates that it is the server
>>>      
>>>
>>that
>>    
>>
>>>causes trouble, but I can read the same url with
>>>      
>>>
>>other
>>    
>>
>>>technologies (java and visual basic) with no
>>>      
>>>
>>hassle at
>>    
>>
>>>all.  And I can read similar but shorter urls from
>>>yahaoo.com with erlang http:request without
>>>      
>>>
>>problems.
>>    
>>
>>>this url can be read successfully:
>>>U1 =
>>>"
>>>
>>>      
>>>
>http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM&f=sl1d1t1c1baphgvn&e=.csv
>  
>
>>>".
>>>
>>>and this fails.
>>>U2 =
>>>"
>>>
>>>      
>>>
>http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
>  
>
>>>".
>>>
>>>both should return a comma separated list of stock
>>>exchange quotes from yahoo.com.
>>>
>>>As I can read the same url with other technologies
>>>      
>>>
>>it
>>    
>>
>>>makes me think that there is a bug in the http
>>>      
>>>
>>client
>>    
>>
>>>module. Or, could it be that I need some
>>>HTTPOptins/Options to make it work?
>>>
>>>I am using erlang R10B-9 on Windows XP SP2
>>>professional edition with all updates applied. I
>>>      
>>>
>>have
>>    
>>
>>>downloaded the precompiled version from
>>>      
>>>
>>erlang.org.
>>    
>>
>>>Best regards
>>>Gronvald
>>>
>>>
>>>I have included program examples below
>>>
>>>this erlang program shows the problem
>>>
>>>% this works
>>>testurl(1) ->
>>>U =
>>>"
>>>
>>>      
>>>
>http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM&f=sl1d1t1c1baphgvn&e=.csv
>  
>
>>>",
>>>geturl(U);
>>>
>>>% this exits
>>>testurl(2) ->
>>>U =
>>>"
>>>
>>>      
>>>
>http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
>  
>
>>>",
>>>geturl(U).
>>>
>>>geturl(Url) ->
>>>application:start(inets),
>>>X = http:request(Url),
>>>case X of
>>>{ok, { {_Version, 200, _ReasonPhrase}, _Headers,
>>>Body} } ->
>>>  Body;
>>>_ -> X
>>>end.
>>>
>>>
>>>this java program will handle same situation
>>>      
>>>
>>without
>>    
>>
>>>error
>>>
>>>import java.net.*;
>>>import java.io.*;
>>>
>>>public class Geturl {
>>>
>>>public static void main(String[] args) throws
>>>Exception {
>>>
>>>String u2 =
>>>
>>>"
>>>
>>>      
>>>
>http://finance.yahoo.com/d/quotes.csv?s=IBM,GE,GM,F,PKD,GW&f=sl1d1t1c1baphgvn&e=.csv
>  
>
>>>";
>>>
>>>URL url = new URL(u2);
>>>InputStream is = new
>>>BufferedInputStream(url.openStream());
>>>Reader r = new InputStreamReader(is);
>>>
>>>int c = r.read();
>>>while(c != -1) {
>>>  System.out.print((char)c);
>>>  c = r.read();
>>>}
>>>}
>>>}
>>>
>>>
>>>
>>>__________________________________________________
>>>Do You Yahoo!?
>>>Tired of spam?  Yahoo! Mail has the best spam
>>>      
>>>
>>protection around
>>    
>>
>>>http://mail.yahoo.com
>>>
>>>      
>>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>  
>



More information about the erlang-questions mailing list