Subject: Problem with emacs open-network-stream (connect()) in -current
To: None <firstname.lastname@example.org>
From: Laine Stump <email@example.com>
Date: 07/29/2004 12:24:53
I have emacs 21.3 and vm 7.17 installed from pkgsrc on two systems - one
is running post 1.6 -current from around Dec 2002, and the other is
running -current from July 15. When I setup VM to get its mail via pop,
the older system works fine, but the newer system fails several times
(each time requiring a "g" keypress to retry) with:
connection failed: operation already in progress
before finally succeeding on making the socket connection and getting
the mail. This message is being printed by the open-network-stream
function (also known as Fopen_network_stream) in emacs' file
process.c. It translates to an errno of EALREADY.
Through a bit of experimentation I found that the problem occurs because
the connect() call in this function sets EINTR most times it is called;
open_network_stream responds to EINTR by immediately re-calling
connect(). The 2nd time connect() is called, it sets EALREADY.
There's already a delay in place in the case of EADDRINUSE, so I changed
it to do the delay in case of EINTR too - this cleared up the problem.
I haven't looked at the older system in detail, so I don't know if it's
1) never setting EINTR, or 2) succeeding on the 2nd call to connect()
rather than setting EALREADY.
Does any of this ring a bell? Could there be a race condition that
didn't used to exist, or maybe one that was already there, but I'm not
seeing it on the older system because it's also slower (933Mhz vs 3Ghz)?
Or should I send a report to the emacs people requesting they make the
same change I made?