-
Notifications
You must be signed in to change notification settings - Fork 846
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
Irreproducibility: Code rebuilds only the first time I switch resolvers #5381
Comments
|
I'll try to repro, but as a first hunch, I guess it's a build cache. If you look at the Running This is the output I get from building one of my pet projects:
The last lines indicate the compilation results are kept in the Now, the issue with your tests is interesting. It should not cache a failed build... maybe? Assuming that's the issue. I'll try to check what's going on. |
The thing that the project doesn't get rebuilt is explained by the fact that 2 LTSes give different implicit snapshots and no config change make it possible for them to coexist even for project packages. But probably it's not something intuitive as e.g. switch between a normal build and a test build invalidates project packages.
I started looking into that but had no time yet. |
I cloned the repo. Noticed it already had After running The project relies on C stuff and a I'm using Ubuntu 18.04.4, Minor finding: when switching resolvers, the test |
@ardamose123 Thanks for letting us know! That's interesting that it didn't (On the point of the project's crash, which is unrelated of the stack issue: Yes, |
Correction: I just saw the However, as I mentioned before, I can build the project alright and run the tests while switching between resolvers, so it might not be related to the original issue. @nh2, can you please describe your development environment w/ versions? |
@ardamose123 Do you also see Also, when you switch resolvers, does it (For the purpose of this bug, I don't worry much about the test output, as that's either a bug in my library's code or a GHC bug. I do worry about stack's rebuilding/unregistering behaviour though.) |
Only first time, just after switching resolvers. |
just for clarity, I mean when you switch resolvers forward and backward repeatedly. |
Just ran the tests a few more times. I only noticed the
I thought I was getting the This behavior LGTM, but I don't know if @nh2 is getting some other behavior. |
@nh2 I think I see the reason behind |
@qrilka The main problem was this:
where the expectation was that it should rebuild because the dependent libraries change. I don't think we've found a solution/explanation for that yet (or did I miss it?). @ardamose123 When you say "logs are normal", does it rebuild + relink the executable after switching resolvers? |
@nh2 see my answer in #5381 (comment) - if you don't do |
@qrilka Ah sorry, I missed that. I don't quite follow it though. I also don't quite understand @ardamose123's preceding comment about
because I'm doing nothing with I still do observe that switching resolvers leaves outdated contents in the Click to expand full log output
Summarised output of the above: % stack test
Linking .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test ...
2 examples, 0 failures
% sha1sum .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test
9d23a8dd39ccfe86c164d52c03d59f103a904eec .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test
% # switch to lts-13.27
% stack test
Linking .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test ...
2 examples, 0 failures
% sha1sum .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test
c0d644d1d1f9d90e241ba5191bbbf2ca15c3ce67 .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test
% # switch to lts-13.26
% stack test
2 examples, 0 failures
% sha1sum .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test
c0d644d1d1f9d90e241ba5191bbbf2ca15c3ce67 .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/lz4-frame-conduit-test/lz4-frame-conduit-test As shown, I switch resolvers, and then the binary at |
Ouch, I didn't take into account that test executables don't go into snapshot-specific directory... |
After trying to fix this I came to conclusion that this doesn't look to be easily resolvable with the way stack builds work and the way to fix it properly is to do proper component-based builds as in #4745 |
I am going to close this issue in favour of #6356, as it appears to be an instance of component-based builds. |
When I switch between
lts-14.27
andlts-13.26
repeatedly, stack rebuilds my code only on the first such switch.This is illegitmate because my executable depends on (at least)
conduit-extra
, and that one's version switches between those LTSs.Background / how I found this
I'm debugging an issue with my library:
The project for reproing (on Ubuntu 18.04): https://github.com/nh2/lz4-frame-conduit/tree/4616ec594426de2defda6432eec9cff04692bf7c
Command to run:
When I test after
stack clean
, my bug (a segfault or GHC panic) occurs withand not with
The actual Stack issue
But when I switch between the 2 and run stack test without previous stack clean, most of the time stack doesn't rebuild the code, so then I cannot observe the difference when switching resolvers.
I get this strange behaviour:
So it rebuilds only the first time I switch resolvers (but for apparently the wrong reason), and then never again.
The text was updated successfully, but these errors were encountered: