Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix "Extracting compiled package archive failed" error #2454

Merged
merged 2 commits into from Jul 18, 2023

Conversation

ystros
Copy link
Contributor

@ystros ystros commented Jul 11, 2023

Previously, there were cases where a package existed the name and fingerprint, but did not match stemcell, was mistakenly excluded from upload. This results in errors like the following:

Task 1939132 | 20:03:34 | Creating new compiled packages: routing-golang-1-linux/8c04109541f4d504f5be559da433998bd459b0f45cd3654557cc3642cc4d2f60 for ubuntu-jammy/1.147 (00:00:00)
                        L Error: Extracting compiled package archive failed. Check task debug log for details.

Now, when deciding which packages do not need to be uploaded, we consider name, fingerprint, dependency key, and stemcell os/version.

We ended up refactoring quite a bit in an effort to make the code more understandable (and understand it ourselves...). The most relevant logic change is in the compiled_package_fingerprints_not_to_be_uploaded method.

aramprice and others added 2 commits July 10, 2023 16:39
For clarity of flow + variable naming

Signed-off-by: Brian Upton <bupton@vmware.com>
Previously, there were cases where a package existed the name and
fingerprint, but did not match stemcell, was mistakenly excluded from
upload. This results in errors like the following:

```
Task 1939132 | 20:03:34 | Creating new compiled packages: routing-golang-1-linux/8c04109541f4d504f5be559da433998bd459b0f45cd3654557cc3642cc4d2f60 for ubuntu-jammy/1.147 (00:00:00)
                        L Error: Extracting compiled package archive failed. Check task debug log for details.
```

Now, when deciding which packages do not need to be uploaded, we
consider name, fingerprint, dependency key, and stemcell os/version.

Signed-off-by: Aram Price <pricear@vmware.com>
@ystros ystros requested review from a team, jpalermo and nouseforaname and removed request for a team July 13, 2023 00:14
Copy link
Member

@jpalermo jpalermo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

else
fingerprint_list = manifest_hash['packages'].map { |package| package['fingerprint'] }.compact
Models::Package.where(fingerprint: fingerprint_list)
.where(Sequel.~(sha1: nil))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could these result in issues where ppl are using the sha256 hack for releases.
where they provide sha1: sha256:HASH256 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly - this code no moved, and not new so if this is an issue we should probably address it in a separate change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The column in the database is always called sha1, regardless of whether an actual sha1 or a sha256 is provided. Sequel.~(sha1: nil) should translate to SQL sha1 IS NOT NULL, so it should cover both sha1 and sha256 cases.

Regardless, this query is not something we changed, simply reordered things to make the structure of both the /matches and /matches_compiled controller actions similar. The diff is messy, but you can see the query in the previously existing code:

matching_packages = Models::Package.where(fingerprint: fingerprint_list)
.where(Sequel.~(sha1: nil))
.where(Sequel.~(blobstore_id: nil)).all

Copy link
Contributor

@nouseforaname nouseforaname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm


json_encode(matching_packages.map(&:fingerprint).compact.uniq)
fingerprints_that_are_already_uploaded - fingerprints_that_need_upload
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering about naming here, is this subtraction the right way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, just realized that the method is called
compiled_package_fingerprints_not_to_be_uploaded

@lnguyen lnguyen merged commit 32d27ba into main Jul 18, 2023
4 checks passed
@lnguyen lnguyen deleted the compiled-package-upload-error branch July 18, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants