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

FileNotFoundException on 2.10.4 while starting two apps using the same dependency in the same ide from time to time #584

Open
pseudo555 opened this issue Dec 9, 2024 · 3 comments

Comments

@pseudo555
Copy link

Hello,

I'm using JSerialComm in two differenty java 8 x64 application on win 10 22h2.
Both application are launched by eclipse neon.

In the second application i start, i see the following errror :

java.io.FileNotFoundException: C:\Users\pdelco\AppData\Local\Temp\jSerialComm.\2.10.4\jSerialComm.dll (Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at com.fazecast.jSerialComm.SerialPort.(SerialPort.java:240)
at fr.def.iss.ssiutils.serial.SerialManager.getAllAvailablePorts(SerialManager.java:247)
at fr.def.iss.logdiag.view.display.ultraTerminal.utils.UltraTerminalUtils.isNoSerialPortFound(UltraTerminalUtils.java:72)
at fr.def.iss.logdiag.view.display.homepage.LogDiagHomePageBuilder.innerRefresh(LogDiagHomePageBuilder.java:344)
at fr.def.iss.ultima4j.view.display.homepage.AbstractHomePage.refreshNode(AbstractHomePage.java:179)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.setContentInMainDisplay(AbstractBaseBuilder.java:290)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplayEnd(AbstractBaseBuilder.java:271)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplay(AbstractBaseBuilder.java:250)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplay(AbstractBaseBuilder.java:230)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.buildGui(AbstractBaseBuilder.java:162)
at fr.def.iss.logdiag.LogDiagApp.start(LogDiagApp.java:160)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

Ligne 240 is
FileOutputStream destinationFileContents = new FileOutputStream(tempNativeLibrary);
And is in a try catch block.

This error is completely invisible for caller, as catch block only dump the stacktrace in the err output (which mean logging application won't be able to catch that part is not configured to do so) and the following block, managing libraryLoaded == false, is not applied here, as the dll file was found.

For me, there is (at least) two fix to be done to handle this error:

  • don't use the same temporary folder (like JNA does).
  • manage this exception properly (i don't know if catch block should set libraryLoaded to false, or if another boolean should be created to deal with this peculiar case).

Note:
Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus
Means
The process cannot access the file because it is being used by another process

@pseudo555
Copy link
Author

pseudo555 commented Dec 9, 2024

Note:

  • v2.11.0 and the commit "Don't delete jSerialComm dir before every load" may fix the "don't use the same temporary folder" part.
  • v2.11.0 doesn't work at all in my case, JVM is closed prematurely. i'll try with the snapshot i found in Upgrade from 2.10.4 to 2.11 causes jvm to crash #555.

@pseudo555
Copy link
Author

I try, still doesn't work in my usecase:

java.io.FileNotFoundException: C:\Users\pdelco\AppData\Local\Temp\jSerialComm\2.11.1-a8a307d-SNAPSHOT\jSerialComm.dll (Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at com.fazecast.jSerialComm.SerialPort.(SerialPort.java:244)
at fr.def.iss.ssiutils.serial.SerialManager.getAllAvailablePorts(SerialManager.java:247)
at fr.def.iss.logdiag.view.display.ultraTerminal.utils.UltraTerminalUtils.isNoSerialPortFound(UltraTerminalUtils.java:72)
at fr.def.iss.logdiag.view.display.homepage.LogDiagHomePageBuilder.innerRefresh(LogDiagHomePageBuilder.java:344)
at fr.def.iss.ultima4j.view.display.homepage.AbstractHomePage.refreshNode(AbstractHomePage.java:179)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.setContentInMainDisplay(AbstractBaseBuilder.java:290)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplayEnd(AbstractBaseBuilder.java:271)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplay(AbstractBaseBuilder.java:250)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.changeDisplay(AbstractBaseBuilder.java:230)
at fr.def.iss.ultima4j.view.display.global.AbstractBaseBuilder.buildGui(AbstractBaseBuilder.java:162)
at fr.def.iss.logdiag.LogDiagApp.start(LogDiagApp.java:160)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

@pseudo555
Copy link
Author

It seems, this filenotfound error has no impact on the software behavior.
by that i means even if this error is displayed in err flux, the application works as intended, as if another retry later worked.

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