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

Revise setup of the faux GAP root #993

Open
fingolfin opened this issue May 22, 2024 · 0 comments
Open

Revise setup of the faux GAP root #993

fingolfin opened this issue May 22, 2024 · 0 comments

Comments

@fingolfin
Copy link
Member

When starting multiple Julia's and using GAP.jl in each of them, there can be issues caused by the shared faux gaproot in a scratch space, despite pidlocking.

To quote myself from Slack:

I guess there is a problem if process 1 loads GAP.jl and is past creating the scratch space and actively loading GAP; then process 2 deletes and recreates the scratch space. Then for a brief moment, the faux GAP root is gone and reads from paths relative to it will fail.
Strictly speaking this can of course also happen at any point after GAP initialization: if something deletes the scratch space it uses, then we have a problem.

Two solutions comes to mind:

  • let each GAP.jl instance have its own faux gaproot. To that end, each process creates its own subdir of the GAP.jl scratch space (e.g. with a name based on its PID, possibly plus a random part). Use mktempdir(gap_scratch_space_dir; cleanup = true) to get the path, ensuring that it is deleted afterwards. In that case the pid locking could also go, as it would be "built in", so to say.
  • change the code re-creating the faux gaproot to be more defensive: force_symlink could be made less brutal: instead of force creating the new symlink, check if it already exists and points at the right path, if it does, just leave it alone. Likewise the code which recreates sysinfo.gap & gac could first assemble the new file content in a string; then read the existing file and compare; and only overwrite it if the content changed.

With approach 2, there could still cause problems if there are actual changes in the symlink paths. To protect against that, the (hashes of) the paths to the relevant artifact (gap_packages, GAP_jll, GAP_lib_jll) could become part of the Scratchspace name.

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

No branches or pull requests

1 participant