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

Provide support to build Quarkus applications with multiple Quarkus developers on the same machine #22515

Closed
Koekebakkert opened this issue Dec 24, 2021 · 4 comments · Fixed by #22743
Assignees
Labels
area/dev-ui kind/bug Something isn't working
Milestone

Comments

@Koekebakkert
Copy link

Describe the bug

Quarkus stores temporary files in /tmp/quarkus during test that are owned by the first Quarkus user on the machine.

Any other user will receive a java.nio.file.AccessDeniedException: /tmp/quarkus/... error that fails his/her builds in maven test phase.

Expected behavior

Quarkus creates a /tmp/quarkus-$USER directory in maven test phase that is owned by that $USER.

Actual behavior

Quarkus creates a /tmp/quarkus directory owned by the first Quarkus user on the machine.

How to Reproduce?

  1. Start clean and run: sudo rm -rf /tmp/quarkus
  2. Login as user foo and go to a Quarkus project that uses @QuarkusTest.
  3. Run mvn test
  4. Login as user bar and go to a Quarkus project that uses @QuarkusTest.
  5. Run mvn test, this will generate a java.nio.file.AccessDeniedException and fail the build.

Output of uname -a or ver

Linux tr-o-dev-5.intravialis.nl 5.15.8-1-default #1 SMP Wed Dec 15 08:12:54 UTC 2021 (0530e5c) x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.13" 2021-10-19 OpenJDK Runtime Environment (build 11.0.13+8-suse-2.2-x8664) OpenJDK 64-Bit Server VM (build 11.0.13+8-suse-2.2-x8664, mixed mode)

GraalVM version (if different from Java)

Tested with 21+

Quarkus version or git rev

Tested with 2.1.0.Final up to 2.6.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

See expected behaviour.

@Koekebakkert Koekebakkert added the kind/bug Something isn't working label Dec 24, 2021
@Koekebakkert
Copy link
Author

Next hurdle is the native image generation that will fail on the /tmp/jib-core-application-layers-cache being owned by the other user. That is actually a jib bug.

@Koekebakkert Koekebakkert changed the title Impossible to build Quarkus applications with multiple Quarkus developers on the same machine Provide support to build Quarkus applications with multiple Quarkus developers on the same machine Dec 24, 2021
@gsmet
Copy link
Member

gsmet commented Dec 31, 2021

This is due to WebJarUtil copying files to /tmp/quarkus. I think we need a better strategy here, probably by creating a specific temp directory for each instance but we need to make sure it's correctly cleaned up when shut down.

Also there are all sorts of specific rules for dev mode and live reload so this needs to be carefully crafted.

/cc @Postremus @phillip-kruger

@Postremus
Copy link
Member

@gsmet This one is quite interesting. On Windows, the generated directory for webjar content is e.g. C:/User/martin/Appdata/Local/Temp/quarkus/....

WebJarUtil however simply uses System.getProperty("java.io.tmpdir"); to determine the temp dir, which might point on linux to anywhere outside the user dir.

I will take a look at this, since I just recently made changes to WebJarUtil anyway.

@Postremus Postremus self-assigned this Dec 31, 2021
@gsmet
Copy link
Member

gsmet commented Dec 31, 2021

Yeah, unfortunately on Linux, the temp directory is global so you end up with /tmp/quarkus for all users.

So my guess is that we would need to create directories with Files.createTempDirectory("quarkus-resources-") and use this directory for all resources and register a shutdown hook to delete it.
But it's going to be a bit more cumbersome than that given how things are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dev-ui kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants