[erlang-questions] HTTP requests and the meaning of eaddrinuse

Johnny Billquist bqt@REDACTED
Fri Jan 30 14:11:20 CET 2009


That don't make sense.
If you exhaust all possible local ports, you should get something like 
resource not available, or something like that. Maybe enobufs.

However, you will most probably hit the limit of the number of open file 
descriptors long before you exhaust all the local port numbers. By 
default on on my mac, the max file descriptors is 256 (per process). 
There is also a limit on the total number of file descriptors in the OS. 
Nowhere near the theoretical limit of 65536 ports in tcp. So that should 
give you enfile or emfile.

eaddrinuse means that you are trying to make a connection using a local 
port that is already in use. I would assume that the system picks a 
local port number at random in this case. The port number used should 
have been checked to not already be in use, but there might be a problem 
there. Maybe a race condition in the system when trying to bind a socket.

	Johnny

Oscar Hellström wrote:
> The error means that you've exhausted all available ports on a network
> interface.
> 
> On Linux, an application without root privileges can only use ports >
> 1024, and up to 65535. This means that if you have 64511 open TCP
> connections, it's impossible to open a new outgoing connection. On
> windows I don't know how many sockets a user process can actually use,
> but I guess there is some kind of setting for this. Other applications
> using the network interface of course also affects this, since the ports
> are not unique per process.
> 
> Philip Fennell wrote:
>> Hello,
>>
>> I've been putting together some Erlang programmes to load a potential
>> very large set of data into CouchDB and when using:
>>
>> http:request(put, {"http://192.168.192.10:5984/infax/00_CF07", [],
>> "application/json", {"_id": "00_CF07", "SeriesTitle": "Harold Wilson",
>> "FirstTransmissionDate": "2000-01-01"}}, [], []).
>>
>> as an example, I do get, from time-to-time when I'm recursing over a
>> large and deep directory structure, an atom returned by http:request of:
>>
>> eaddrinuse
>>
>> However, I've been unable to find any reference to its meaning. Could
>> someone tell me what the error eaddrinuse actually means, and for that
>> matter why it might be happening.
>>
>> I'm using Erlang R12B-5 on Windows XP SP2 (but I'm sure that doesn't
>> have anything to do with it).
>>
>>
>> Regards
>>
>> Philip Fennell
>>
>>   
>>> XML Developer (The Forge)
>>>
>>> BBC Future Media & Technology
>>> Media Village, 201 Wood Lane London W12 7TP
>>> BC4 C4, Broadcast Centre
>>>
>>> T:	0208 0085318
>>>     
>> http://www.bbc.co.uk/
>> This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
>> If you have received it in error, please delete it from your system.
>> Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
>> Please note that the BBC monitors e-mails sent or received.
>> Further communication will signify your consent to this.
>> 					
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>   
> 
> Best regards
> 


-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt@REDACTED             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol



More information about the erlang-questions mailing list