solved Email Timeout

Melih
Melih
@melih
8 years ago
198 posts
Hello guys,

I have a problem and i have no idea what cause this or how can i fix this.

Whenevet the site sends notification emails some of them returns an error saying that "connection timeout". Most of them are sent. I couldn't see a specific pattern or a user or someting else about this problem. I am using a real mail address and actual settings of the hosting. Even test mails may return error. I don't know anything about mail servers. Maybe my mail server sometimes slows down but i am not sure. Can this timeout period be inceased. Would it work if we increase it? Or do you have any idea how to fix it? Because i have no idea :)

Thanks
updated by @melih: 07/25/16 03:04:30PM
michael
@michael
8 years ago
7,746 posts
Feels like a server issue. First thing I would look for is to go check the server error logs to see if there are any clues in there.

Searching for "mail connection timeout" via the search engines brings back a few very specific results related to exact issues, there wasn't a general cause, so if there is something in the server logs that gives clues that would be a good starting point.

Might also throw your hosting company an email letting them know too they might be able to provide a bit of quick insight.
Melih
Melih
@melih
8 years ago
198 posts
Hello Michael, thanks for your reply.

I made a trial about this issue and i have sent 20 emails in a row to the users one of them whis is in the middle was not sent again but the emails following this one were sent. The interesting thing is these errors occur randomly.

I also talked with the hosting company they asked for the error logs and they will further investigate the problem.
brian
@brian
8 years ago
10,148 posts
The "connection timeout" issue means the remote end did not respond in time - usually this is due to throttling, or some sort of rate limiting on the remote end. If you see this frequently, I would recommend setting the Email Core -> Max Send Rate to something low (say 5) so you don't get limited by the remote end.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
8 years ago
198 posts
Hello Brian,

The first thing that i tried to set that max send rate. Even thoungh i saw an error after that.

Btw i didn't see any email error for 4 days. I hope it was a temporary problem. I will see it in time.

Brian, where is the setting time for this timeout in the code. Maybe increasing it manually help me.
michael
@michael
8 years ago
7,746 posts
Melih:....where is the setting time for this timeout in the code...
ACP -> COMMUNICATION -> EMAIL CORE -> GLOBAL CONFIG -> MAX SEND RATE (per minute)
Melih
Melih
@melih
8 years ago
198 posts
Hello Michael,

I didn't ask that :) I set that already actually before i post this issue.
I asked timeout time setting. I mean i think there is a line for timeout in the code for how many second system will try to send a mail. I thought if i can increase that second manually in the code this will be help to send.
michael
@michael
8 years ago
7,746 posts
Not understanding sorry. You want to know where the
ACP -> COMMUNICATION -> EMAIL CORE -> GLOBAL CONFIG -> MAX SEND RATE (per minute)

takes effect in the code? which file/line?

That setting sets a config variable named:
$_conf['jrMailer_throttle']

Its used in many places, so a search of the codebase is probably the easiest way to locate the point you're interested in.

Possibly this line is what your after (guess):
/modules/jrCore/include.php in the _init() function
    // We run the core email queue
    if (isset($_conf['jrMailer_throttle']) && $_conf['jrMailer_throttle'] > 0) {
        jrCore_register_queue_worker('jrCore', 'send_email', 'jrCore_send_email_queue_worker', intval($_conf['jrMailer_throttle']), 1);
    }
    else {
        jrCore_register_queue_worker('jrCore', 'send_email', 'jrCore_send_email_queue_worker', 0, 4);
    }

That reads, "If the mail throttle setting is set, then configure the sending email queue workers to fire off at the defined interval"
Melih
Melih
@melih
8 years ago
198 posts
My problem is like this:

Message 	Error sending email using configured transport
Date 	14/04/16 00:10:19
URL 	/user/login?r=1
Memory 	8.8MB
Data 	
Array
(
    [mailinfo] => Array
        (
            [subject] => Updates are available for Eğriçayır
            [message] => 
The following Marketplace Updates are available for your system:

modules:
        Private Notes
        System Core
        Image Core
        Search
        Users
    
You can install these new updates from your Marketplace:

http://www.egricayir.org/marketplace/system_update


---------------------------------------

Bildirim tercihlerinizi Hesap Ayarları / Bildirimler alanından değiştirebilirsiniz.

http://www.egricayir.org/user/notifications


Hemen tüm bildirimleri kapatmak için aşağıdaki linki tıklatın:

http://www.egricayir.org/user/unsubscribe/6b6272e0f749241015d79c695


            [from] => egricayir@egricayir.org
        )

    [errormsg] => Connection to sub4.mail.dreamhost.com:587 Timed Out
)

That is automaticly generetad system mail to inform me about updates.
And i am searching to find a way to fix this. So i was thinking there must be a time setting for example 5 seconds to try to send a email in the mail core or somewhere else. And maybe i increase that it can be give a chance to connection to server. I suspect that maybe my email server slows down sometimes. But i am just guessing...
updated by @melih: 04/14/16 05:12:59AM
Melih
Melih
@melih
8 years ago
198 posts
I chanced
->setTimeout(5);
to
->setTimeout(30);
in the 126th and 132nd line in include.php in jrMailer. I don't know if i have changed the right line but what i did seems to be working because the emails are sent.
updated by @melih: 04/14/16 09:07:57AM
michael
@michael
8 years ago
7,746 posts
Thanks. We've got this changed from (5) to (10) for the next core release, (30) seams excessive.
Melih
Melih
@melih
8 years ago
198 posts
Actually i made it 30 to be able to see wheter it works or not. Since i have found its place i can manually increase it in case any need. Or maybe you can add this as an option to the ACP.
brian
@brian
8 years ago
10,148 posts
30 seconds is a REALLY long timeout - that means it is taking 30 seconds for the remote server to even respond to the request, which means it is either very overloaded, or the network between your JR server and the mail server is very congested. I would think you may run into other email delivery issues with it being that slow, but at least it's connecting for you now.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
8 years ago
198 posts
Yes Brian, it looks like connecting and sending now. I made it 30 to test it.

Thanks for your assistance, both of you.

Tags