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

multicradle: can there be a race issue with HIE_BIOS_OUTPUT ? #220

Closed
teto opened this issue Jul 3, 2020 · 3 comments
Closed

multicradle: can there be a race issue with HIE_BIOS_OUTPUT ? #220

teto opened this issue Jul 3, 2020 · 3 comments
Labels
type: documentation Improvements or additions to documentation

Comments

@teto
Copy link
Contributor

teto commented Jul 3, 2020

The professional project I am working on is too big to be loaded in ghcide. It has several libraries in a (bazel) monorepo.
So for now we select one library and generate an appropriate $HIE_BIOS_OUTPUT (follow up on https://github.com/digital-asset/ghcide/issues/679).
I would like to leverage ghcide 0.2 multicradle support and generate a bios file per library. It seems possible with the new "shell" cradle type (note that it doesnt appear in https://github.com/mpickering/hie-bios#configuration-specification).
To sum up I think I should create one cradle per library

cradle:
    multi:
        # we default to none because of all the non-haskell folders at the root
        - path: "./bazel-out"
          config: { cradle: { none:  } }
        - path: "./_generated"
          config: { cradle: { none:  } }
        - path: "./project/scoring"
          config:
              cradle:
                  bios:
                      shell: ".hie-bios scoring $HIE_BIOS_ARG"
                      dependency-program: ".hie-bios-dependencies scoring"
        - path: "./project/maths"
          config:
              cradle:
                  bios:
                      program: ".hie-bios maths $HIE_BIOS_ARG"
                      dependency-program: ".hie-bios-dependencies maths"
        - path: "./project/other"
          config:
              cradle:
                  bios:
                      program: ".hie-bios other $HIE_BIOS_ARG"
                      dependency-program: ".hie-bios-dependencies other"

My question is the following:
does .hie-bios still has to write to $HIE_BIOS_OUTPUT ? Can't there be a race condition where one file erases the other ?

NB: It could be nice to open the github wiki so that people can share some insights.

@fendor fendor added the type: documentation Improvements or additions to documentation label Jul 3, 2020
@fendor
Copy link
Collaborator

fendor commented Jul 3, 2020

You are probably right, there could be a race when using hie-bios. I think ghcide takes care that the project initialization is done only in a single thread, so it should not be an active issue.
Nevertheless, it should be documented.

@mpickering
Copy link
Collaborator

How would this race condition happen? Each process runs it's own environment. The variable is not set globally.

@teto
Copy link
Contributor Author

teto commented Jul 3, 2020

it's called with a different value of $HIE_BIOS_OUTPUT every time. I realized when seeing temporary files in /tmp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants