IntersectMBO / cardano-node

The core component that is used to participate in a Cardano decentralised blockchain.
https://cardano.org
Apache License 2.0
3.06k stars 723 forks source link

[BUG] - Hydra: `error: cannot update flake input 'cardano-node/cardano-node-workbench/membench' in pure mode` #4525

Closed aciceri closed 1 year ago

aciceri commented 1 year ago

Internal/External External

Area Nix

Summary Hydra gives out this evaluation error when trying to evaluate a flake containing cardano-node as input.

hydra-eval-jobs returned exit code 1:
error: cannot update flake input 'cardano-node/cardano-node-workbench/membench' in pure mode
error: worker error: error: cannot update flake input 'cardano-node/cardano-node-workbench/membench' in pure mode

It looks like it tries to lock some inputs (but they should be all specified in the lockfile) but fails it Hydra works in pure mode.

Maybe this is due to its weird "recursive" inputs which also causes this warning using Nix from CLI:

warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-measured'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-process'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-snapshot'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'nixpkgs'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-measured'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-process'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-snapshot'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'nixpkgs'
warning: input 'cardano-node/node-measured/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-measured'
warning: input 'cardano-node/node-measured/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-process'
warning: input 'cardano-node/node-measured/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-snapshot'
warning: input 'cardano-node/node-measured/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'nixpkgs'

Or maybe this is an error in Nix (or Hydra?) itself that can't manage follows as it should.

Steps to reproduce Create a flake with cardano-node as input and add it to Hydra.

Expected behavior It just works.

System info (please complete the following information):

Additional context In case this was a bug in Hydra or Nix I think that IOG is using some workaround to make their stuff build on Hydra (or maybe IOG doesn't use Hydra? TBH I've no idea), maybe someone could share it here? I tried adding several following to my inputs to be sure that they are locked but I had no luck.

Kranzes commented 1 year ago

I believe this comes from github:input-output-hk/empty-flake (which gets called many times) not having a flake.lock.

aciceri commented 1 year ago

I've just tried but it doesn't work.

I've added a lockfile to empty-flake (here if someone wants to try it) adding an input, running nix flake lock and then deleting the input (running nix flake lock without inputs doesn't create any lockfile). Then I've done this change to my flake

cardano-node.inputs.cardano-node-workbench.membench.url = "<emptyFlakeWithLockfile>";

but I got this error:

error: cannot find flake 'flake:cardano-node-workbench' in the flake registries

       … while updating the flake input 'cardano-node-recent/cardano-node-workbench'

       … while updating the flake input 'cardano-node-recent'

       … while updating the lock file of flake '<myFlake>'

So I've chose to fork cardano-node itself replacing empty-flake occurrences with my new empty flake with lockfile but I'm getting the same evaluation error by Hydra as before.

marijanp commented 1 year ago

Just to make sure I understood you correctly you've replaced all the occurences of empty-flake in the cardano-node flake, are you sure you've covered all transitive dependencies? And the error is the previous one?

I think someone responsible for this flake should join the discussion and hopefully explain why this empty-flake is needed in the first place....

BTW: This error is triggered in hercules-CI too so it's not just hydra related. Seems like GHA has impurities

aciceri commented 1 year ago

Just to make sure I understood you correctly you've replaced all the occurences of empty-flake in the cardano-node flake, are you sure you've covered all transitive dependencies? And the error is the previous one?

I've not been able to cover all the transitive dependencies directly overriding inputs in the flake.nix since checking the flake.lock file I could see many empty-flake with input-output-hs as owner. By the way I was getting same error.

So, now I've directly edited the lockfile replacing every occurrences there with my empty-flake which has a lockfile. Now nix CLI doesn't work anymore (it stucks indefinitely) and Hydra gives the same error as before.

I've also noticed that if I try to delete cardano-node lockfile and make nix (now I'm using my system version i.e. 2.11.0) recreate it stucks again (not sure, I stop getting any output for minutes, but I can see that CPU is working).

BTW: This error is triggered in hercules-CI too so it's not just hydra related. Seems like GHA has impurities

Maybe GHA impurities are due to --no-update-lock-file here?

I think someone responsible for this flake should join the discussion and hopefully explain why this empty-flake is needed in the first place....

Not sure who to ping, maybe @jbgi since he has created empty-flake?

aciceri commented 1 year ago

Doing this seems to work:

empty-flake.url = "github:input-output-hk/empty-flake?rev=2040a05b67bf9a669ce17eca56beb14b4206a99a";
cardano-node-workbench = {
  url = "github:input-output-hk/cardano-node/ed9932c52aaa535b71f72a5b4cc0cecb3344a5a3";
  inputs.membench.follows = "empty-flake";
};
cardano-node = {
  url = "github:input-output-hk/cardano-node?ref=1.35.3";
  inputs.cardano-node-workbench.follows = "cardano-node-workbench";
  inputs.node-measured.follows = "cardano-node-workbench";
};
disassembler commented 1 year ago

I think this hack is what your looking for, but I thought this was fixed in 1.35.3 tag.

https://github.com/input-output-hk/cardano-world/blob/4890ca5aa358c83ecd1981ab0ec1fbb0f542f0b4/flake.nix#L18

marijanp commented 1 year ago

@disassembler I added that line and referred to cardano-node with tag 1.35.3-configs. This is the error I get when executing nix flake lock --update-input cardano-node:

warning: Git tree '/home/marijan/workspace/ardana/cardano-app-template' is dirty
warning: input 'cardano-node' has an override for a non-existent input 'membench'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-measured'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-process'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-snapshot'
warning: input 'cardano-node/cardano-node-workbench/membench' has an override for a non-existent input 'nixpkgs'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-measured'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-process'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'cardano-node-snapshot'
warning: input 'cardano-node/node-measured/cardano-node-workbench/membench' has an override for a non-existent input 'nixpkgs'
marijanp commented 1 year ago

@disassembler same issue for release 1.35.4

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

aciceri commented 1 year ago

I confirm that this is still a problem and I add that I also get this error using Hercules CI.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

andreabedini commented 1 year ago

Still a problem

❯ nix shell nixpkgs#hydra-unstable --command hydra-eval-jobs --flake github:input-output-hk/cardano-node/0c5d82b08160077cc415dcd2897bab2a62ccb5ee
warning: `--gc-roots-dir' not specified
error: cannot update flake input 'cardano-node-workbench/membench' in pure mode
error: worker error: error: cannot update flake input 'cardano-node-workbench/membench' in pure mode