Fatal uncaught exception randomly happening
Moderators: Chris Corbyn, General Moderators
Fatal uncaught exception randomly happening
Greetings -
I was randomly getting this error, so I upgraded to 3.3.1 today - but I'm still getting the error....
strangely, it's only happening sometimes.
If I get the error, I can usually hit refresh and it works with no problems.
Fatal error: Uncaught exception 'Swift_BadResponseException' with message 'Expected response code(s) [250] but got response []' in F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php:250 Stack trace: #0 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(310): Swift->assertCorrectResponse(Object(Swift_Events_ResponseEvent), 250) #1 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(319): Swift->command('RSET', 250) #2 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(412): Swift->reset() #3 F:\Inetpub\wwwroot\CQ\PHP\weblayout\includes\register3.php(77): Swift->send(Object(Swift_Message), Object(Swift_Address), Object(Swift_Address)) #4 F:\Inetpub\wwwroot\CQ\PHP\weblayout\index.php(85): include('F:\Inetpub\wwwr...') #5 {main} thrown in F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php on line 250
I was randomly getting this error, so I upgraded to 3.3.1 today - but I'm still getting the error....
strangely, it's only happening sometimes.
If I get the error, I can usually hit refresh and it works with no problems.
Fatal error: Uncaught exception 'Swift_BadResponseException' with message 'Expected response code(s) [250] but got response []' in F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php:250 Stack trace: #0 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(310): Swift->assertCorrectResponse(Object(Swift_Events_ResponseEvent), 250) #1 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(319): Swift->command('RSET', 250) #2 F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php(412): Swift->reset() #3 F:\Inetpub\wwwroot\CQ\PHP\weblayout\includes\register3.php(77): Swift->send(Object(Swift_Message), Object(Swift_Address), Object(Swift_Address)) #4 F:\Inetpub\wwwroot\CQ\PHP\weblayout\index.php(85): include('F:\Inetpub\wwwr...') #5 {main} thrown in F:\Inetpub\wwwroot\CQ\PHP\weblayout\swiftlib\swift.php on line 250
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Unless you need send() for a specific reason, just use batchSend() which deals with such errors. The empty response occurs on networks which are experiencing high loads or spotty TCP traffic (dropped packets). High resource usgae can sometimes cause timeouts on the remote server too. batchSend() catches exceptions and deals with them, whereas send() makes you responsible for dealing with the errors via try/catch.
Thanks!
Great! Thank you. I've done some tests with the batchSend() and so far everything seems to be OK.
Our mail server is shared with a lot of other companies, so I suspect that is causing the error.
I'm going to make all my changes and closely monitor my php error log. Thanks again!
Our mail server is shared with a lot of other companies, so I suspect that is causing the error.
I'm going to make all my changes and closely monitor my php error log. Thanks again!
Dang...
Hello again -
It seems like this didn't work.
Do you think it has something to do with my SMTP server?
Here is the output form my php error log:
[07-Sep-2007 17:00:58] PHP Fatal error: Uncaught exception 'Swift_Connection_Exception' with message 'There was a problem reading line 1 of an SMTP response. The response so far was:<br />[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps?' in D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift\Connection\SMTP.php:232
Stack trace:
#0 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(307): Swift_Connection_SMTP->read()
#1 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(418): Swift->command('??.', 250)
#2 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(472): Swift->send(Object(Swift_Message), Object(Swift_Address), 'alex@gandrpubli...')
#3 D:\Inetpub\WWWroot\GandRPub\admin\stats.php(70): Swift->batchSend(Object(Swift_Message), Object(Swift_RecipientList), 'alex@gandrpubli...')
#4 {main}
thrown in D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift\Connection\SMTP.php on line 232
It seems like this didn't work.
Do you think it has something to do with my SMTP server?
Here is the output form my php error log:
[07-Sep-2007 17:00:58] PHP Fatal error: Uncaught exception 'Swift_Connection_Exception' with message 'There was a problem reading line 1 of an SMTP response. The response so far was:<br />[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps?' in D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift\Connection\SMTP.php:232
Stack trace:
#0 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(307): Swift_Connection_SMTP->read()
#1 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(418): Swift->command('??.', 250)
#2 D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift.php(472): Swift->send(Object(Swift_Message), Object(Swift_Address), 'alex@gandrpubli...')
#3 D:\Inetpub\WWWroot\GandRPub\admin\stats.php(70): Swift->batchSend(Object(Swift_Message), Object(Swift_RecipientList), 'alex@gandrpubli...')
#4 {main}
thrown in D:\Inetpub\WWWroot\GandRPub\admin\swiftlib\Swift\Connection\SMTP.php on line 232
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I have a bug in my logic 
Something to this effect:
I really need a try/catch followed by a boolean return on the code that fixes the problem.
However, since this is happening for you I'm going to hazard a guess that your server is kicking you off. How many emails are you sending in one go? Some servers have a cap and quite literally kick you off and stop you from sending more emails. Gmail does this after 100 emails in (I think) an hour.
Something to this effect:
Code: Select all
try {
//something that bails
} catch (...) {
//fix it by running something that *might* fail
}However, since this is happening for you I'm going to hazard a guess that your server is kicking you off. How many emails are you sending in one go? Some servers have a cap and quite literally kick you off and stop you from sending more emails. Gmail does this after 100 emails in (I think) an hour.
I have one instance where there are 4 recipients at once - otherwise, it is one or two recipients.
So, I'm really not trying to shoot too many at once.
It isn't that busy either, really... there wouldn't be many simultaneous customers at the same time either... but I do know the SMTP server is shared through many clients of our host.
Having said that, I also admin another site that uses OS Commerce on the same server using the same SMTP server - OS Commerce uses the mail() function - and my php error log shows many lines that show:
[09-Sep-2007 08:08:54] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: SMTP server response: 455 sorry, system is too busy [955] (#4.4.5) in D:\long_urlhere\email.php on line 520
Moreover, there are often times during the day when employees around here get "send or receive errors" using Outlook when trying to send an email - - they wait a couple seconds and try again... then it usually works.
In other words, I'm starting to wonder if our shared SMTP server we use from our host is getting too much of a workout.
That would be my guess....
Have you ever heard of anyone using swiftmailer using the enterprise edition of Google Apps for Your Domain? I like the idea of 10 gig per account - but, if they only allow 100 per hour, that may not cut it. I'm wondering if there is a difference between the regular free Gmail and Google Apps for Your Domain. (probably a better question elsewhere, I know).
At any rate, do you have any suggestions? Would you be willing to bet it is a problem with my SMTP server?
Is there something I should modify in my existing code?
I really appreciate your help!
[/i]
So, I'm really not trying to shoot too many at once.
It isn't that busy either, really... there wouldn't be many simultaneous customers at the same time either... but I do know the SMTP server is shared through many clients of our host.
Having said that, I also admin another site that uses OS Commerce on the same server using the same SMTP server - OS Commerce uses the mail() function - and my php error log shows many lines that show:
[09-Sep-2007 08:08:54] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: SMTP server response: 455 sorry, system is too busy [955] (#4.4.5) in D:\long_urlhere\email.php on line 520
Moreover, there are often times during the day when employees around here get "send or receive errors" using Outlook when trying to send an email - - they wait a couple seconds and try again... then it usually works.
In other words, I'm starting to wonder if our shared SMTP server we use from our host is getting too much of a workout.
That would be my guess....
Have you ever heard of anyone using swiftmailer using the enterprise edition of Google Apps for Your Domain? I like the idea of 10 gig per account - but, if they only allow 100 per hour, that may not cut it. I'm wondering if there is a difference between the regular free Gmail and Google Apps for Your Domain. (probably a better question elsewhere, I know).
At any rate, do you have any suggestions? Would you be willing to bet it is a problem with my SMTP server?
Is there something I should modify in my existing code?
I really appreciate your help!
[/i]
same problem
I too am having this problem since moving to my own VPS. Not on a shared server
SMTP is set to 200 ph so I set the throttler to 3 per 60 secs. = 180ph
Still the problem periodically exists.
Anyone solved this yet????
SMTP is set to 200 ph so I set the throttler to 3 per 60 secs. = 180ph
Still the problem periodically exists.
Anyone solved this yet????
As in
give the mail server a bit more time to juggle electrons and thrash the disks around
Rgds,
Code: Select all
$smtp->setTimeout(25);Rgds,