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

Temp file creation fails with JDK 17 #1115

Closed
marinier opened this issue Feb 8, 2022 · 2 comments · Fixed by #1151
Closed

Temp file creation fails with JDK 17 #1115

marinier opened this issue Feb 8, 2022 · 2 comments · Fixed by #1151
Labels
android Android bug Something isn't working

Comments

@marinier
Copy link

marinier commented Feb 8, 2022

Creating a temporary file in an Android app via Files.createTempFile(null, ".tmp"); works for GraalVM 22 JDK 11, but not JDK 17.

Expected Behavior

Using the reproducer below, I expect output like this in the console (which I get with JDK 11 versions of GraalVM):

[Tue. Feb. 08 14:34:16 EST 2022][INFO] [SUB] D/GraalCompiled(11718): Created temp file at: /data/user/0/com.gluonapplication.gluonmobilesingleviewproject/9221306799863213037.tmp

Current Behavior

An exception is thrown when trying to create the temp file with JDK 17 versions of GraalVM:

[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): Failed to create temp file
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): java.nio.file.NoSuchFileException: /tmp/13973661146619086989.tmp
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.nio.file.Files.newByteChannel(Files.java:380)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.nio.file.Files.createFile(Files.java:658)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.nio.file.TempFileHelper.create(TempFileHelper.java:136)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:159)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.nio.file.Files.createTempFile(Files.java:923)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.gluonapplication.GluonApplication.<init>(GluonApplication.java:17)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.lang.reflect.Constructor.newInstance(Constructor.java:480)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:803)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.security.AccessController.doPrivileged(AccessController.java:107)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at java.lang.Thread.run(Thread.java:833)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
[Tue. Feb. 08 13:39:45 EST 2022][INFO] [SUB] D/GraalCompiled( 5369): 	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)

One potentially suspicious element is that the path it reports when it fails is completely different (in /tmp instead of /data/user/0/com.gluonapplication.gluonmobilesingleviewproject).

Steps to Reproduce

I have a simple reproducer here: https://github.com/marinier/androidtempfiletest

The README in there contains additional details.

Your Environment

Ubuntu 20.04 64-bit running in a VirtualBox VM on a Windows 10 64-bit host.

I have tried building with various versions of GraalVM 22:

  • Oracle GraalVM CE 22.0.0.2 JDK 11
  • Oracle GraalVM CE 22.0.0.2 JDK 17
  • Gluon GraalVM 22.0.0.3 JDK 11
  • Gluon GraalVM 22.0.0.3 JDK 17

I have tried this on Android 10, 11, and 12 (Samsung and Pixel phones) with the same result.

@marinier marinier added the bug Something isn't working label Feb 8, 2022
@jperedadnr jperedadnr added the android Android label Feb 9, 2022
@jperedadnr
Copy link
Contributor

Filed oracle/graal#4497

@marinier
Copy link
Author

Looks like they closed it without addressing it, claiming it's not their problem :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Android bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants