Intermittent API Failure

148 views
Skip to first unread message

Chubacca

unread,
Feb 3, 2011, 9:17:53 AM2/3/11
to MailChimp API Discuss
Hello, I'm having intermittent API failures, and I'm wondering if
anyone can help me here. We've been making the same calls through the
API for months (no code changes) and suddenly today it started
failing. It seems to be inconsistent, as in if I refresh a page with
test code sometimes the call will succeed and sometimes it will fail
with the exact same code. Not only this, but the calls always return
false but there is no error that is reported. Here is a sample call:

$api = new MCAPI($apikey);
...
$success = $api->campaignCreate($type, $opts, $content, $segopts);
if ($api->errorCode){
var_dump($api->errorCode);
var_dump($api->errorMessage);
}
return $success;

The error code and error message for these calls when they fail are
always the empty string. Not only this, but when they fail, my
MailChimp account shows no record of the call being made at all.
Could our servers perhaps be having trouble hitting the API servers?
We're using the minified 1.3 PHP code. Thanks in advance!

jesse

unread,
Feb 3, 2011, 11:37:25 AM2/3/11
to MailChimp API Discuss
Have you looked at your stats?
http://apidocs.mailchimp.com/faq/#faq3

It is unlikely that the calls are failing, rather that the client is
timing out (we don't time out calls on our side). You can adjust the
timeout levels to avoid that.


jesse

Chubacca

unread,
Feb 3, 2011, 1:03:21 PM2/3/11
to MailChimp API Discuss
The stats show no record of the call ever being made, which is what is
weird about it. It just waits for a bit, and returns false which is
what led me to believe it was having trouble connecting to your
servers. Is there a reason the client would be inconsistently timing
out at this point?

On Feb 3, 8:37 am, jesse <je...@mailchimp.com> wrote:
> Have you looked at your stats?http://apidocs.mailchimp.com/faq/#faq3

jesse

unread,
Feb 4, 2011, 12:23:12 PM2/4/11
to MailChimp API Discuss
Calls not being logged is a sign that we never received the request,
which indicates general connectivity issues. I had another user report
general connectivity issues yesterday as well. We've double checked
our load balancer configs and I've had a script running for almost 24
hours that has made made 13.5k successful calls without any timeouts
or connectivity issues. We're still poking around, but at this point
it seems like your location is, for some reason, having issues simply
getting traffic to us consistently, which is something we can't fix
from our end.


jesse

Chubacca

unread,
Feb 4, 2011, 4:56:31 PM2/4/11
to MailChimp API Discuss
I was assuming that it was connectivity issues (which is why I said we
were having trouble hitting the servers). Is there no error that is
returned for a Timeout? I haven't poked around your code enough, but
it seems like that if it had a timeout our nothing returned, there
should be some error within the API. We also tested, and our server
was able to hit and pull from tons of other locations during this
inconsistent failure. Timeouts and connectivity issues are
understandable, but I was just concerned because there was no error
that was being returned. I've noticed it to be much better since that
time early in the morning, however.

Ruven

jesse

unread,
Feb 7, 2011, 6:41:39 PM2/7/11
to MailChimp API Discuss
I was finally able to reproduce the behavior with the MCAPI wrapper
that you reported by forcibly dropping (via restarting an apache
process) the connection in the middle of a call. As soon as it's
tested a bit more, we'll put out a new version of the MCAPI wrapper
(probably some time tomorrow). If you do look at the current code, we
were handling normal connection failures and time outs correctly.



jesse

jesse

unread,
Feb 9, 2011, 2:50:32 PM2/9/11
to MailChimp API Discuss
An updated version of the MCAPI wrapper is now available which
properly handles the situation where the connection is somehow dropped
mid-call and no usable data or error code is returned.


jesse

Laurence

unread,
Feb 14, 2011, 2:53:31 PM2/14/11
to MailChimp API Discuss
Hello,

I wanted to know if you've had high loads recently that would prevent
connections from happening? I've just upped the timeout on our end
from 300 to 500s after reading this thread hoping this will fix the
problem. I'm also updating the php wrapper.

The intermittent connection errors started Feb 11 at 8:45am PST for
us. It used to work fine and we haven't made any changes to that part
of the code. We are using the php MCAPI class provided in the docs
from jan 2011 and getting these 3 types of php warnings:

PHP Warning: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]: SSL: connection
timeout in .../MCAPI.class.php on line 2423

PHP Warning: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]: Failed to enable
crypto in .../MCAPI.class.php on line 2423

PHP Warning: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a>]: unable to connect
to ssl://us2.api.mailchimp.com:443 (Unknown error) in .../
MCAPI.class.php on line 2423

And the api errorMessage is "Could not connect (ERR 0: )" as we were
not using the new wrapper.

I'm asking cause I also saw another thread about a wordpress plugin
not working anymore.

Thx!

Laurence

jesse

unread,
Feb 14, 2011, 5:38:41 PM2/14/11
to MailChimp API Discuss
What you are seeing there is not related to the error that was being
discussed above and I would not expect to see anything different using
the newest version of the wrapper since it specifically addressed the
issue in this thread.

Those errors look more like your server's having issues with SSL -
upgraded packages or not having enough entropy could easily cause
something like that.


jesse
Reply all
Reply to author
Forward
0 new messages