Skip to content

strip sourcemap from Dockerfile builds - #5012

Merged
vito merged 1 commit into
dagger:mainfrom
vito:strip-sourcemap
Apr 24, 2023
Merged

vito merged 1 commit into
dagger:mainfrom
vito:strip-sourcemap

Conversation

@vito

@vito vito commented Apr 24, 2023 •

Copy link
Copy Markdown
Contributor

A bug seems to be leading to a gigantic pb.Definition value which exceeds the gRPC message size. I ran into this when trying to run Bass's tests in Dagger:

cd bass/
dagger run ./bass/test -i src=./

It's really slow for other reasons; more PRs coming! But it should reliably trigger the bug.

I tried to investigate why this was happening, and attempted a fix in Buildkit (changed something from an x.ys = append(x.ys, ys) to just x.ys = ys), but my fix broke the tests, so I'm not sure if it's right.

Here's a gist for the gigantic pb.Definition and the "fixed" one: https://gist.github.com/vito/be84c33a40f243ad472e63b88cce5658

Basically Buildkit is repeatedly adding the same source information hundreds of times. I think this is partly caused by the fact that we propagate mounts from one container to the next, but my understanding of this is loose at best.

I don't think users have a way to interact with this value right now, so stripping it seems OK, but I may be missing some use case, and it would be better to get a fix upstream.

This seems to be leading to a gigantic pb.Definition value which exceeds
the gRPC message size.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito requested a review from sipsma April 24, 2023 15:41

@sipsma sipsma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think users have a way to interact with this value right now, so stripping it seems OK, but I may be missing some use case, and it would be better to get a fix upstream.

Yeah we don't use this AFAIK anywhere right now, so LGTM. I agree it would be much better to understand and fix upstream though as it's entirely possible we'll want this someday.

I remembered this PR which feels like it could be intertwined somehow: moby/buildkit#2859

But on a quick glance through the code I couldn't really make heads or tails of what was going on, haven't interacted with the source map part of the codebase at all previously, so no clear ideas immediately on how to fix there.

@vito

vito commented Apr 24, 2023 •

Copy link
Copy Markdown
Contributor Author

I remembered this PR which feels like it could be intertwined somehow: moby/buildkit#2859

Yep, that's the exact change I undid and the test that started failing. 😂

Seems like we need another way to approach this in Buildkit. I'll put a TODO in my notes to figure this out upstream. (That's not worth much though at this point...)

@vito
vito merged commit 09e6382 into dagger:main Apr 24, 2023
@vito
vito deleted the strip-sourcemap branch April 24, 2023 22:27
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.

2 participants