Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Event on Timeout #125

Closed
nerdyglasses opened this Issue Nov 14, 2012 · 23 comments

Comments

Projects
None yet
4 participants

I've had an IDLE Connection to my Gmail account for about 30 min. or so.

After that I've tried to send some E-Mails to my Gmail account which didn't get fetched from node-imap.
It must be like this due to the short Gmail IDLE Timeout.

I've setup an Event Listener to "close" and "error". Those didn't get fired.
Is there a elegant way to detect those connection timeouts in order to let a reconnect happen?

Regards,
Christian

Owner

mscdex commented Nov 14, 2012

Can you provide the code you're using that's exhibiting this behavior?

Sure, I've modified the mail-listener package a little bit.
https://github.com/nerdyglasses/mail-listener/blob/master/lib/mail.listener.coffee

Have a look at line 30-35.

Owner

mscdex commented Nov 16, 2012

Well, the connection shouldn't get disconnected just from idling, as it is set to re-IDLE every 29 minutes (as suggested by the IDLE RFC).

Are you sure you're idling on the right mailbox and that your test emails aren't being automatically labeled and/or archived?

Also, is the new mail just not detected after 30 minutes, or is it any length of time?

Owner

mscdex commented Nov 16, 2012

Additionally, the 'mail' event handler is passed the number of new messages, not a message id of any kind.

I'm sure I'm idling on the right mailbox.
Today it just worked perfectly well. It runs now for 3 hours on my local machine. After that 3h Emails still arrive.
Yesterday I waited for 40 minutes. After that the server didn't notice new emails.

What do you mean with "after 30 minutes"? Do you mean 30 minutes after the email was in the inbox or 30 minutes after the connection has been established?

Owner

mscdex commented Nov 16, 2012

After the connection was established (after the mailbox was selected to be more precise).

I think I may have found a bug with how I'm re-IDLE'ing. I will push a fix soon.

UPDATE!
This E-Mail didn't arrive in my mailbox! Sorry for that.

Owner

mscdex commented Nov 16, 2012

Ok, if you get a chance, try the master branch now and see if this latest commit helps any.

I'll give it a try today. I'll keep you up to date.

On a long run it didn't work.
After a week or so connections broke but there was no event triggered so that I couldn't reconnect.

Owner

mscdex commented Jan 16, 2013

Just for kicks, can you try again with the master branch? I just landed a commit that reworks the connection process, so hopefully you should get the proper 'end' and/or 'close' events upon disconnection all the time.

nhagen commented Jan 17, 2013

I've also been plagued by this problem--I just tested the master branch to no avail. I usually only notice the issue after I leave it up over night. Came into the office today and sent an email, and nothing happened.

It looks like after reconnecting once, it will not initiate another restart a timeout. This is observable if you reduce MAX_WAIT to a short time period. It will re-idle once and then stop re-idling. Tested using npm installed module and master.

Emails where fetched after 7 days or so. This works for me now.
I don't know if it was from npm install or master. I've tried both. I think the master works for me.
Before I tried the master I forked this repo so when I reinstall I'm sure to have the same version running every time.

It worked for me with this version:
https://github.com/nerdyglasses/node-imap

My commits are useless. You can ignore them.

Thanks a lot, btw!

nhagen commented Jan 21, 2013

Could you clarify what you mean by 'Emails were fetched after 7 days or so'? After 7 days of uptime it started working again? Is this still an issue?

It worked the entire time span.
The App reconnected every time when a connection was lost.

nhagen commented Jan 23, 2013

Does receiving new messages delay timeouts?

I've been sending emails to an account every 5 minutes for the last 24 hours or so with no issues. Not sure that means the issue has been fixed though.

Before it didn't work for half a day for me.

Owner

mscdex commented Feb 12, 2013

Is this working for everyone now then?

nhagen commented Feb 12, 2013

I haven't had much time to work on it, but I don't think its working for me. I'll try to look into it again today and confirm. If it doesn't work, I'll try the mail-listener gem above to see if its something wrong with my implementation.

nhagen commented Feb 13, 2013

I'm still not getting notifications about new emails using either node-imap's master branch or @nerdyglasses 's fork of mail-listener after as little as ~1 hour.

How can I look into this further?

Owner

mscdex commented Mar 30, 2013

@nhagen I'd say turn on debug and see what's (not) being sent/received

For me it works for weeks now.

@mscdex mscdex closed this Apr 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment