Traceback in `identify()` call
jaddison opened this issue · comments
Over the last few days, I've seen quite a few of these happening in our production environment. What's shakin' bacon?
Traceback (most recent call last):
File "/home/projectteam/.virtualenvs/project/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/projectteam/.virtualenvs/project/local/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
return self.run(*args, **kwargs)
File "/home/projectteam/live/profiles/tasks.py", line 124, in post_signup_actions
CIOEventUserSignup.identify(user, last_updated=date_format(timezone.now(), "U"))
File "/home/projectteam/live/util/emails.py", line 203, in identify
cls.cio.identify(customer_id, **data)
File "/home/projectteam/.virtualenvs/project/local/lib/python2.7/site-packages/customerio/__init__.py", line 102, in identify
self.send_request('PUT', url, kwargs)
File "/home/projectteam/.virtualenvs/project/local/lib/python2.7/site-packages/customerio/__init__.py", line 90, in send_request
raise CustomerIOException(message)
CustomerIOException: Failed to receive valid reponse after 3 retries.
Check system status at http://status.customer.io.
Last caught exception -- <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'makefile'
Related to #19 maybe?
Seems more like a networking problem contacting track.customer.io?
Maybe, but 'NoneType' object has no attribute 'makefile'
is disconcerting.
Looks that error happens when a socket hasn't been opened - which is probably as @newhook suggested, a networking error.
Using httplib directly seems like a bit of an unfortunate design choice, maybe we should try using requests
if available and then fallback to httplib instead @jatinn let's talk about that
Happy holidays @jaddison, we just updated our library to use requests under the hood and have uploaded the latest release on pypi.
Hopefully this version should help with the error you are having.
If you still have problems with it would you mind sharing some more info about your setup? from your stack trace it looks like you are using a celery task to update your cio account, so are you creating a new connection for each task or reusing the same one.
Hi, so our Customer.io code is wrapped in a simple class:
class CIOEventBase(object):
cio = CustomerIO(settings.CUSTOMERIO_SITE_ID, settings.CUSTOMERIO_API_KEY)
@classmethod
def identify(cls, obj, **extra):
...
@classmethod
def track(cls, obj, **kwargs):
...
So, instances of this class are never created - so if I were going to guess at the answer to your question, I'd say there's likely some attempt at connection reuse.
I'm going to update to 0.2.x to see if using requests improves the situation.
I haven't seen this issue since Jan 12. Closing as fixed, due to the change to requests
.