Hashsum failures during tests

During two spread runs I got the following error:

snap install --channel=beta core

error: cannot perform the following tasks:

- Download snap "core" (1577) from channel "beta" (sha3-384 mismatch after patching "core": got 3ca758bb05ff3a422fffa2c02018aaf63909417180b3e902eaddcf0cbc4d4c317bfe26ac5c39567bc69abb94ece0d1e8 but expected cbdff81206101ef7063f2f91a4c3f36e1ad946fe8a809eca4c21fa5335968dfc0c696e5f364cbc9a4c83590aceb3fc15)
-----

The “after patching” is a red-herring, there is no patching involved, the error message is just misleading (there is a PR:3152 to fix that). It appears that its just generic download errors from the store, i.e. we do not get what we asked for.

Links:

The logs indicate it is actually an error related to retry:

Apr 07 05:56:38 ubuntu snapd[7503]: 2017/04/07 05:56:38.101263 logger.go:75: DEBUG: < "HTTP/1.1 206 PARTIAL CONTENT\r\nContent-Length: 36864\r\nCache-Contro

Apr 07 05:56:38 ubuntu /usr/lib/snapd/snapd[7503]: task.go:303: DEBUG: 2017-04-07T05:56:38Z ERROR sha3-384 mismatch after patching "core": got 3ca758bb05ff3a422fffa2c02018aaf63909417180b3e902eaddcf0cbc4d4c317bfe26ac5c39567bc69abb94ece0d1e8 but expected cbdff81206101ef7063f2f91a4c3f36e1ad946fe8a809eca4c21fa5335968dfc0c696e5f364cbc9a4c83590aceb3fc15

The 206 is most likely involved. Some code path is likely doing a range request and then ignoring the fact it should append instead of simply write out the received data. This may be confirmed by testing if the obtained hash is valid for an arbitrary chunk of 36864 bytes of the given core snap.

@chipaca Can you have a look at this when you have a moment?

1 Like

Fwiw, it appears it is always getting the same mismatch: 3ca758bb05ff3a422fffa2c02018aaf63909417180b3e902eaddcf0cbc4d4c317bfe26ac5c39567bc69abb94ece0d1e8 erroneous one.

It looks like our retry handling code is correct and I suspect that the CDN is sending us a wrong data. I created a (mostly blackbox) test in https://github.com/snapcore/snapd/pull/3158/files that triggers an EOF in the middle of the download and it handles the issue correctly.

That’s curious indeed. I wonder if this is some sort of error message.

I’ve merged the test.