NetLogo / NetLogo/Arduino-Extension
If leave and return to arduino exten. get Native Library already loaded error
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
This is a regression from 6.2.2 caused by the deprecation of the Object method finalize as of Java 9.
This was not caught by the compiler because the finalize method is obtained by reflection.
One way to reproduce:
- Open Models Library Arduino Example
- Click setup [Do not need to have an arduino board attached, just click OK in the dialog that says "No available arduino ports were found."]
- Re-Open Arduino Example
Error message will appear
java.lang.UnsatisfiedLinkError: Native Library /Users/aab1638/.jssc/mac_os_x/libjSSC-2.6_x86_64.jnilib already loaded in another classloader
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.load0(Unknown Source)
at java.base/java.lang.System.load(Unknown Source)
at jssc.SerialNativeInterface.(SerialNativeInterface.java:172)
at jssc.SerialPortList.(SerialPortList.java:43)
at arduino.ArduinoExtension$Ports.report(ArduinoExtension.java:112)
at org.nlogo.prim._externreport.report(_externreport.java:31)
at org.nlogo.prim._asm_proceduresetup_setprocedurevariable_6.perform()
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)NetLogo 6.3.0
main: org.nlogo.app.AppFrame
thread: AWT-EventQueue-0
OpenJDK 64-Bit Server VM 17.0.4 (BellSoft; 17.0.4+8-LTS)
operating system: Mac OS X 10.14.6 (x86_64 processor)
Scala version 2.12.16
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: Arduino Example02:15:18.265 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
02:15:18.265 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:18.264 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:15:18.192 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:18.144 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:15:17.986 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:17.782 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:17.580 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:17.379 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:15:17.179 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure by opening and reopening the Arduino Example, then trace the stack from jssc.SerialNativeInterface through arduino.ArduinoExtension$Ports.report. Inspect how the reflective finalize lookup and native library loading interact across classloaders. Done means the Arduino Example can be reopened without the UnsatisfiedLinkError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, java
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100