Comment 3 for bug 1627865

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Hi Sergio,

I've looked at this a bit closer, and I believe what's happening is that snapcraft is assuming the response from the store is a 200 response. The exact code in snapcraft is:

    content = requests.get(self.__status_details_url).json()

This code should probably check that the response has a 200 status code before trying to decode the contents - something like this perhaps:

    response = requests.get(self.__status_details_url)
    if response.status_code != 200:
        # do error handling here
    else:
        content = response.json()

I believe what's happening here is that there's a race condition between snapcraft pushing the snap to CUD and a record of that upload appearing in the SCA database. If you're unlucky snapcraft will try and get a status upload for the upload before SCA knows about it. In this case you will get a 404 response with the body b'Not Found', which causes the json decoding to blow up, as in the original bug report.

This happens about 1 time in 20 for me, but since all my packets have to travel around the world before they hit the store I suspect this will be worse for people in London (for example).

Let me know if this makes sense.

Cheers,