-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
Package's ".x" is not reproducible between dependency upgrade #4111
Comments
Forgot to add: I also tried to compile the go_library several times in a loop
and was able to verify that the So the few bytes changes must come from the dependency upgrade, just unclear why. |
@sluongng I discovered something related - it appears that the .x archive is not reproducible even if the interface of the package is constant. The .x file should not change if I modify this file to return
I do not think we are getting much/any benefit from separating the .a from the .x, as intended by #2461 |
@joeljeske Does this reproduce if you make the implementation more complicated? I wouldn't be surprised if the export data ensures that this function is inlined into every caller. |
Yes, the x archive still changes even when the implementation is more complex. Here is a draft PR with a script to show the issue. #4143 Does rules_go have any test case that asserts on this functionality? I'm not certain if this is a result of the rules_go implementation of extracting the pkgdef information, or something in golang native that is causing the instability. In any case, I think this performance feature may not be working as intended, and there are potentially huge gains to be had 😄 |
Also, should I move this to a new issue, as its not exactly the same issue as @sluongng? But it does feel very related. |
Yeah, I think you are observing the effect described in golang/go#69547. IIUC, the Go team responds that
In a remote build setup, separating the 2 reduces the input size of GoCompilePkg actions significantly. I do think though, that ultimately, a fix in upstream Go tooling would be very much desirable. If the exported "interface" in a package was not changed, the '.x' output should be stable. I did not find the time to create a follow-up with the Go team on this issue though. It would be nice if someone else could help with this. |
I think there is more missing reproducibility. I've built the same target on two machines configured the same way and got different When inspecting with diffoscope following the example above, I've observed that constants (both private and public) are included in different (random?) order. I traced two differences to validation types and cardinality. There were also other differences that looked like ordering as well, but not for constants and not as easy to trace. 005da4b0: 6564 0133 084f 7074 696f 6e61 6c01 3108 ed.3.Optional.1. |
@annapst Could you file an issue with upstream for this? That's a pretty clean diff and the existing explanations for why there may be a difference don't apply. |
with a setup like this
I could not reproduce
It would be nice to get a small reproduction from your end @annapst |
I also didn't reproduce it starting from a small example. After digging into differences between our repository build and a simple go example, I found that the difference in ".x" files on the same commit appears only when I run builds with nogo, so I'm not sure if this is go compiler problem or not. I'll be going after upgrading rules_go to latest and checking if that's still the case, I see nogo got separated into a separate action, will share an update then! |
I'm actually able to reproduce this in rules_go's own tests now and will investigate further. |
This is a tracking issue for golang/go#69547
I was upgrading our external dependencies recently and these 2 GoCompilePkg actions ran on the same package between 2 consecutive commits.
Specifically, the package is
server/util/db
with a single source filedb.go
. The upgraded dependency wasgorm.io/driver/{mysql,clickhouse,sqlite}
. There was no code change in db.go.The expectation is for
db.x
output to stay the same between the 2 compilations as no exported data was change. However, we observed that there were some bytes differences between the 2.x
files, which caused downstream compile actions to all rebuild.I tried using various gcexports tools to decode the 2 files and diff them but the contents are pretty much identical. Consulting upstream Go team for more information on the 7-bytes diff.
The text was updated successfully, but these errors were encountered: