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

Fix unspecified behaviour in readStorePathCAMap #4008

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

aszlig
Copy link
Member

@aszlig aszlig commented Sep 13, 2020

When deploying a Hydra instance with current Nix master, most builds would not run because of errors like this:

queue monitor: error: --- Error --- hydra-queue-runner
error: --- UsageError --- nix-daemon
not a content address because it is not in the form '<prefix>:<rest>': /nix/store/...-somedrv

The last error message is from parseContentAddress, which expects a colon-separated string, however what we got here is a store path.

Looking at the worker protocol, the following message sent to the Nix daemon caused the error above:

Value Description
0x1E wopQuerySubstitutablePathInfos
0x01 Number of paths
0x16 Length of string
/nix/store/...-somedrv Store path
0x00 Length of string
"" Empty content address string

Looking at writeStorePathCAMap, the store path is indeed the first field that's transmitted. However, readStorePathCAMap expects it to be the second field on my machine, since expression evaluation order is a classic form of unspecified behaviour in C++.

This has been introduced in #3689, specifically in commit 66a62b3.

When deploying a Hydra instance with current Nix master, most builds
would not run because of errors like this:

  queue monitor: error: --- Error --- hydra-queue-runner
  error: --- UsageError --- nix-daemon
  not a content address because it is not in the form '<prefix>:<rest>': /nix/store/...-somedrv

The last error message is from parseContentAddress, which expects a
colon-separated string, however what we got here is a store path.

Looking at the worker protocol, the following message sent to the Nix
daemon caused the error above:

  0x1E -> wopQuerySubstitutablePathInfos
  0x01 -> Number of paths
  0x16 -> Length of string
  "/nix/store/...-somedrv"
  0x00 -> Length of string
  ""

Looking at writeStorePathCAMap, the store path is indeed the first field
that's transmitted. However, readStorePathCAMap expects it to be the
*second* field *on my machine*, since expression evaluation order is a
classic form of unspecified behaviour[1] in C++.

This has been introduced in NixOS#3689,
specifically in commit 66a62b3.

[1]: https://en.wikipedia.org/wiki/Unspecified_behavior#Order_of_evaluation_of_subexpressions

Signed-off-by: aszlig <aszlig@nix.build>
@aszlig
Copy link
Member Author

aszlig commented Sep 13, 2020

Cc: @matthewbauer in case the notification via commit referencing didn't work

@edolstra
Copy link
Member

Thanks!

@Ericson2314
Copy link
Member

Ah, I should have fixed this myself after we hit this exact same thing on another branch where it was slightly changed. Thanks!

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