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

bug 1746940: debug_id lookup by code_file/code_id (part 2) #2791

Merged
merged 4 commits into from Sep 7, 2023
Merged

bug 1746940: debug_id lookup by code_file/code_id (part 2) #2791

merged 4 commits into from Sep 7, 2023

Conversation

willkg
Copy link
Collaborator

@willkg willkg commented Sep 7, 2023

  • bug 1746940: add debug fields to FileUpload model
  • bug 1746940: implement sym data capture at upload
  • bug 1746940: implement code_file/code_id lookup for download API
  • bug 1746940: add sym debug data to File page

We pushed the migration and migrated both stage and prod. This is the followup PR with all the code changes to populate those fields in the upload API and use them for looking up debug_id given a code_file/code_id in the download API.

This captures some additional data for sym files at the time of upload
so we can later use it to do code id to debug id lookups and sym file
debugging.
When the Socorro processor stackwalker requests sym files with bogus
debug id 000000000000000000000000000000000 Tecken would return a 404
because it had no idea what sym file was being requested.

This changes the download API so that if there are valid code_file and
code_id querystring params, it'll look up the FileUpload record and
return the correct debug_id. Then it'll issue an HTTP 302 with the
correct download API url.

This keeps track of how often it does a successful code_file/code_id
lookup with:

* `tecken.download_symbol_code_id_lookup`
This adds the data to the upload_file API and adds the data in a Symbol
File Data section to the File page in the ui.

class DownloadForm(forms.Form):
code_file = forms.CharField(required=False)
code_id = forms.CharField(required=False)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should have removed this form and its usage when we removed the missing symbols bookkeeping a while back. It's vestigial and doesn't do anything now.

@@ -38,9 +42,6 @@ def _ignore_symbol(symbol, debugid, filename):
if filename == "file.ptr":
return True

if debugid == "000000000000000000000000000000000":
return True
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We no longer want to ignore this case.

file_upload = (
FileUpload.objects.filter(code_file=code_file, code_id=code_id)
.order_by("created_at")
.last()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.last() returns either an object or None.

:returns: None (no record with that combination) or the debug_id

"""
logging.info("looking up by code_file %s code_id %s", code_file, code_id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops--this shouldn't be a .info.

settings.MIME_OVERRIDES = {"html": "text/html"}
assert get_key_content_type("foo.bar") is None
assert get_key_content_type("foo.html") == "text/html"
assert get_key_content_type("foo.HTML") == "text/html"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved these tests to a separate file for upload utils functions.

key_existing.invalidate(client, "publicbucket", "somefile.txt")
size, metadata = key_existing(client, "publicbucket", "somefile.txt")
assert size == 0
assert metadata is None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved these tests to a separate file with upload utils functions.

INFO CODE_ID 5DDC1E9E8B000 basic-opt64.dll
INFO GENERATOR mozilla/dump_syms XYZ
FILE 0 C:\\Users\\Calixte\\dump_syms\\test_data\\basic.cpp
FILE 1 d:\\agent\\_work\\2\\s\\src\\vctools\\crt\\vcstartup\\src\\heap\\delete_scalar_size.cpp
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This header comes from the dump_syms tests. It seemed convenient to test with their test data.

MODULE Linux x86_64 20AD60B0B4C68177552708AA192E77390 basic.full
INFO CODE_ID B060AD20C6B47781552708AA192E7739FAC7C84A
FILE 0 /home/calixte/dev/mozilla/dump_syms.calixteman/test_data/linux/basic.cpp
PUBLIC 1000 0 _init
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This header comes from the dump_syms tests. It seemed convenient to test with their test data.

@willkg willkg merged commit e4ed26d into mozilla-services:main Sep 7, 2023
1 check passed
@willkg willkg deleted the bug-1746940-codeid branch September 7, 2023 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant