I've got a django app in production running on nginx/uwsgi. We recently started using SSL for all our connections. Since moving to SSL, I often get the following message:

HTTPSConnectionPool(host='foobar.com', port=443): 
    Max retries exceeded with url: /foo/bar

Essentially what happens is I've got the browser communicating with django server code, which then uses the requests library to call an api. Its the connection to the api that generates the error. Also, I've moved all our requests into one session (a requests session, that is), but this hasn't helped.

I've bumped up the number of uwsgi listeners since I thought that could be the problem, but our load isn't that high. Also, we never had this problem before SSL. Does anyone have some advice as to how to solve this problem?

Edit

Code snippet of how I call the API. I've posted it (mostly) verbatim. Note its not the code that actually fails, but the requests library that throws an exception when calling self.session.post

def save_answer(self):
    logger.info("Saving answer to question")
    url = "%s1.0/exam/learneranswer/" % self.api_url
    response = {'success': False}

    data = {'questionorder': self.request.POST.get('questionorder'),
            'paper': self.request.POST.get('paper')}
    data['answer'] = ",".join(self.request.POST.getlist('answer'))
    r = self.session.post(url, data=simplejson.dumps(data))
    if r.status_code == 201:
        logger.info("Answer saved successfully")
        response['success'] = True
    elif r.status_code == 400:
        if r.text == "Paper expired":
            logger.warning("Timer has expired")
            response['message'] = 'Your time has run out'
        if r.text == "Question locked":
            response['message'] = \
                'This question is locked and cannot be answered anymore'
        else:
            logger.error("Unknown error")
   
Edit
Report