Re: [Evolution] IMAP scanning gets stuck



On Fri, 2001-11-23 at 17:04, Jeffrey Stedfast wrote:
On Fri, 2001-11-23 at 17:31, Dan Winship wrote:
On Fri, 2001-11-23 at 19:03, Jeffrey Stedfast wrote:
I wish there was a way to manually set the tcp timeout, but there isn't.

We could do a non-blocking connect followed by a select with a timeout.

However, the tcp timeout isn't 30 minutes anyway, so something else is
going on here.

Yea, 30 minutes does seem to be a bit high... but I just assumed he was
exaggerating.

Yes, I was a tad exaggerating. However, it is still pretty high, long
enough to be annoying.


from the manpage:

       ETIMEDOUT
              Timeout while attempting connection. The server may
              be  too  busy  to accept new connections. Note that
              for IP sockets the timeout may be  very  long  when
              syncookies are enabled on the server.

so maybe the server has syncookies enabled? they don't really say what
"very long" is :-)

Anyways, we already set the socket to O_NONBLOCK before we connect() and
do a select() on the socket after afaik, so this doesn't seem to work on
linux systems.

The timeout on a blocking connect() in Linux can vary depending on the
destination IP address. I have seen timouts of 14 minutes for
destination outside the LAN. In my code, I usually set the socket to
O_NONBLOCK with fcntl() before doing the connect. I then use poll with a
10 second timeout (I have a pretty busy server), and that has always
worked well for me. 


Also, I seem to recall reading in some man page or another that the
linux connect() always blocks anyway? I could have sworn I read this a
while back after noticing that winsock was able to do non-blocking
connect()'s.

If you use O_NONBLOCK correctly, connect() can be made non-blocking. As
I said, that is what I do in my code.



ah, I was right...we *do* use O_NONBLOCK on the socket while
connect()ing... we also set the timeout to 4 minutes (which is the
standard tcp timeout for blocking connects) while also allowing the user
to cancel the connection with the stop button.

I guess we could set the timeout to something smaller, but I don't see
what that really gains us here (since the user can force a disconnect at
any time).

How do I do that? I can't even exit Evolution since the shell is waiting
for the mailer to quit, and the mailer is stuck. So I use killev. Pretty
ugly...Also, depending on the user to force a manual disconnect is not
clean IMHO.



Jeff


-- Dan



Ujwal





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]