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

[PROF-10028] Avoid re-uploading already successfully uploaded file #24

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

Gandem
Copy link
Member

@Gandem Gandem commented Jun 24, 2024

While looking at a local run of #23 I noticed the following logs (truncated), which come from uploading the local symbols for /usr/bin/docker multiple times.

time="2024-06-21T21:12:25.489808710Z" level=info msg="Symbols uploaded successfully for executable: &{Arch:amd64 GNUBuildID:f9e5ec69231b8b8051d58c5998f1ad8211be58af GoBuildID:Q0IBrcoBQipcsw5gRK-x/mopRzMQH1Hw5GPtpymQt/NpuCDZjIVq2xk9eYXtTf/f-lXVQrOOOumMwcdeq-B FileHash:083ce3583a48215bc026386a7edb819f Platform:elf Type:elf_symbol_file fileName:/usr/bin/docker}"
...
time="2024-06-21T21:14:48.123064125Z" level=info msg="Symbols uploaded successfully for executable: &{Arch:amd64 GNUBuildID:f9e5ec69231b8b8051d58c5998f1ad8211be58af GoBuildID:Q0IBrcoBQipcsw5gRK-x/mopRzMQH1Hw5GPtpymQt/NpuCDZjIVq2xk9eYXtTf/f-lXVQrOOOumMwcdeq-B FileHash:083ce3583a48215bc026386a7edb819f Platform:elf Type:elf_symbol_file fileName:/usr/bin/docker}"
...
time="2024-06-21T21:26:49.408987187Z" level=info msg="Symbols uploaded successfully for executable: &{Arch:amd64 GNUBuildID:f9e5ec69231b8b8051d58c5998f1ad8211be58af GoBuildID:Q0IBrcoBQipcsw5gRK-x/mopRzMQH1Hw5GPtpymQt/NpuCDZjIVq2xk9eYXtTf/f-lXVQrOOOumMwcdeq-B FileHash:083ce3583a48215bc026386a7edb819f Platform:elf Type:elf_symbol_file fileName:/usr/bin/docker}"

This happens because the process manager only keeps track of executables as long as they are mapped for an existing process. In the case above, a process is running the docker CLI, so the process manager sees the executable a first time. Then the docker CLI commands exists, the process manager forgets about that executable (through RemoveOrDecRef()). The next time a docker CLI process is launched, the process manager will consider it as a new executable, and hence we try to re-upload symbols for that binary.

In the short-term, we can work around this by adding a cache on already uploaded files and avoid re-uploads if they were previously already uploaded successfully.

@Gandem Gandem force-pushed the nayef/upload-cache branch 2 times, most recently from 3d86a02 to 04afab1 Compare June 24, 2024 16:01
@Gandem Gandem requested review from nsavoire and r1viollet June 24, 2024 16:44
return &DatadogUploader{
ddAPIKey: ddAPIKey,
intakeURL: intakeURL,

Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: why the extra lines (mostly curious)

Copy link
Member Author

Choose a reason for hiding this comment

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

mostly cosmetic to separate fields that are based on user input, from internal fields that are initialized by the structure itself

const sourceMapEndpoint = "/api/v2/srcmap"

type DatadogUploader struct {
ddAPIKey string
intakeURL string

uploadCache *lru.SyncedLRU[libpf.FileID, struct{}]
Copy link
Collaborator

Choose a reason for hiding this comment

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

the choice of file ID seems good
If we want to consider split debug, we would probably not cache the id of the split file, only of the main binary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed 👍 That's how it's implemented in #25 AFAICT 👌

r1viollet
r1viollet previously approved these changes Jun 25, 2024
Copy link
Collaborator

@r1viollet r1viollet left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks for analyzing the scenario that lead to this!

nsavoire
nsavoire previously approved these changes Jun 25, 2024
Base automatically changed from nayef/local-symbols to main June 25, 2024 11:59
@Gandem Gandem dismissed stale reviews from nsavoire and r1viollet June 25, 2024 11:59

The base branch was changed.

@Gandem Gandem force-pushed the nayef/upload-cache branch from 04afab1 to 1e4ada9 Compare June 25, 2024 13:11
@Gandem Gandem requested review from nsavoire and r1viollet June 25, 2024 13:15
@Gandem Gandem merged commit cffbc05 into main Jun 25, 2024
5 checks passed
@Gandem Gandem deleted the nayef/upload-cache branch June 25, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants