Fixing alpine’s TCP timeouts

I’ve mentioned that I use alpine almost exclusively as a means of communicating around the world; mutt might be the darling of the Linux geek world, but alpine is what I prefer. It does, on the other hand, have a few annoying aspects.

The biggest one is a little difficult to explain, partly because I’m not sure why it does this. I have three or four e-mail accounts, all with GMail (yes, I know, it’s not wise), and I tend to bounce between them, depending on the situation. The “problem” occurs in that (I think) GMail allows a connection to drop when a different account is opened.

That is not a big deal; I expect as much, but alpine seems to be a little unhappy with that. Rather than just allowing an e-mail account to close, alpine gets paranoid and has a minute-long panic attack as it tries to continue to communicate with that particular account.

And so there is a 60-second hang while alpine counts out the seconds allotted to a timeout, then gives me an opportunity to break the connection. If I don’t see the offer in the five seconds it appears on the screen, I have to wait another 22 seconds for the next one to appear. And so on, and so on, until the final timeout and alpine just gives up.

None of that would really be a problem, except with three accounts open, you need to triple the amount of time it takes to acknowledge the account is closed, and regain control of alpine. So at the minimum, three minutes, at the maximum … well, however long it takes you to notice the prompt and instruct alpine to close the account.

I was willing to live with this because screen shows a visual prompt when a warning bell sounds in alpine, and if I am alert, I can jump to the other screen and kick alpine, before going back to whatever I was doing.

So, if all that explanation makes sense, the good news is that I found the “hidden” settings that cut that delay down to a matter of seconds, instead of upwards of three minutes. According to this page, setting the TCP Read Warning Timeout and the TCP Query Timeout to their minimum values cuts that lag to a smidgin.

Which I can vouch for. Now, instead of waiting a full minute for a prompt that allows me to regain control of alpine, I only have to wait 5 seconds. If I miss it, there’s another one in another 5 seconds. No longer do I have to tap my nails on the tabletop, waiting to continue typing an e-mail.

It’s possible that I’ve only found a workaround, or that there is a better and correct way to solve this problem. As it is though, this turns a rather annoying mode of behavior into a very slim blip on the irritation scale. I’m satisfied with that.

5 thoughts on “Fixing alpine’s TCP timeouts

  1. Adrian

    They’re not suspect, I just don’t think it’s wise to rely solely on gmail.. (For that reason, I own a gmail, hotmail and yahoo account..)

  2. johan

    I had the same problem. It disappeared when I set the “Maximum Remote Connections” to 0. The default for this setting is 3. That means it tries to keep 3 IMAP folder-connections open so it does not need a reconnect when switching between these folders. I’m not sure why my connection was dropped so often (May be SSL related) but it did. Hope this helps anyone, took me a few days to figure this out 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s