Skip to content

Resolved possible jnidispatch.dll conflict on Windows #2301

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

Closed
wants to merge 2 commits into from

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Sep 12, 2014

This pull request needs to be tested on affected systems.

From: processing/processing#2239

  If there's is some other Java program installed that uses JNA and
  jnidispatch.dll happens to be in the path then JNA in Processing
  will try to load it and probably crash due to some version mismatch.

  The issue can easily be solved by setting jna.nosys to make sure JNA
  will always extract the correct native lib from it's jar and ignore
  any libs in the system path:

    -Djna.nosys=true

Fix #1948

@cmaglie
Copy link
Member Author

cmaglie commented Oct 1, 2014

@pfeerick @chital

Are you still affected by the issue on JNA.jar incompatibility? may you check if this pull request solves it? A prebuild IDE to check is here:

http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-2301-BUILD-47-windows.zip

@pfeerick
Copy link
Contributor

pfeerick commented Oct 2, 2014

Cristian,

I re-created the issue by adding Filebot to the system path again, as it
has a jnidispatch.dll that Processing and Arduino don't like (v4 as opposed
to 3.0.4 supplied with Arduino).

The new #2301 doesn't seem to have fixed the problem. However, Processing
has fixed this issue between v2.1.1 and 2.2.1, and the only other thing
they've changed that appears relevant is they've also updated the launch4j
wrapper... perhaps that's the other part of the problem? Arduino's ant
script is pulling in v3.0.2 of launch4j, and processing is using v3.4. If I
get a chance I'll pull the latest commits for Arduino 1.5.x and trying
changing the launch4j version...

There were no related error messages from the debug launcher for 1.5.8 when
I removed the offending jnidispatch.dll from the system path (only pre 1.5
core warnings).

Hope this helps.
Pete

Arduino 1.0.6 - simply does nothing except show the splash screen, debug
launcher did flash error message but didn't stay open.

Arduinio 1.5.8 - splash screen and error message for regular launcher
"launch4j: an error occurred while starting the application", debug
launcher gives this:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.sun.jna.Native.pointerSize()I
at com.sun.jna.Native.pointerSize(Native Method)
at com.sun.jna.Native.(Native.java:93)
at processing.app.windows.Platform.(Platform.java:286)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at processing.app.Base.initPlatform(Base.java:269)
at processing.app.Base.main(Base.java:139)

Arduino #2301 build - splash screen and error message for regular launcher
"launch4j: an error occurred while starting the application", debug
launcher gave this log:

Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.sun.jna.Native.pointerSize()I
at com.sun.jna.Native.pointerSize(Native Method)
at com.sun.jna.Native.(Native.java:93)
at processing.app.windows.Platform.(Platform.java:286)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at processing.app.Base.initPlatform(Base.java:269)
at processing.app.Base.main(Base.java:139)

On Wed, Oct 1, 2014 at 9:40 PM, Cristian Maglie notifications@github.com
wrote:

@pfeerick https://github.com/pfeerick @chital
https://github.com/chital

Are you still affected by the issue on JNA.jar incompatibility? may you
check if this pull request solves it? A prebuild IDE to check is here:

http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-2301-BUILD-47-windows.zip


Reply to this email directly or view it on GitHub
#2301 (comment).

@cmaglie cmaglie modified the milestones: Release 1.5.9, Release 1.5.8 Oct 7, 2014
@cmaglie
Copy link
Member Author

cmaglie commented Nov 5, 2014

@pfeerick
may you drop the Filebot's jnidispatch.dll somewhere so I can try to reproduce the issue locally?

@pfeerick
Copy link
Contributor

pfeerick commented Nov 6, 2014

That bits easy : https://dl.dropboxusercontent.com/u/190356/jnidispatch.dll

I haven't had time to look at this, sorry, with study starting up again and
life getting in the way..

from: processing/processing#2239

  If there's is some other Java program installed that uses JNA and
  jnidispatch.dll happens to be in the path then JNA in Processing
  will try to load it and probably crash due to some version mismatch.

  The issue can easily be solved by setting jna.nosys to make sure JNA
  will always extract the correct native lib from it's jar and ignore
  any libs in the system path:

    -Djna.nosys=true

Fix arduino#1948
@pfeerick
Copy link
Contributor

@cmaglie I've tried this latest build (123)... still no luck. To easily replicate this, I made a batch script that launches both the regular build debug launcher, and the PR build launcher with and without the conflicting JNA dll in the path. Once the exception is thrown (which is almost instant, I just have to kill the arduino launcher using the task manager). Grab it from here if it is of any use: https://dl.dropboxusercontent.com/u/190356/arduino%20JNA%20test.cmd

Again, no errors other than pre 1.5 library spec warnings from the non JNA conflict launches. Line three of the exception message has changed between build 47 and 123 (processing.app.windows.Platform).

Start Arduino 1.5.8 Debug (w/ BAD JNA) ...
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
        at com.sun.jna.Native.pointerSize(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:93)
        at processing.app.windows.Platform.<clinit>(Platform.java:286)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at processing.app.Base.initPlatform(Base.java:269)
        at processing.app.Base.main(Base.java:139)
Start Arduino PR 2301 BUILD 123 Debug (w/ BAD JNA) ...
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
        at com.sun.jna.Native.pointerSize(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:93)
        at processing.app.windows.Platform.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at processing.app.BaseNoGui.initPlatform(Unknown Source)
        at processing.app.Base.initPlatform(Base.java:181)
        at processing.app.Base.main(Base.java:95)

@cmaglie
Copy link
Member Author

cmaglie commented Jan 18, 2015

Hi @pfeerick

I'm having hard times to reproduce the issue, on my system the IDE always starts without problems...

What I've done is:

  1. I've copied your jnidispatch.dll into C:\jna
  2. In your batch file I've changed the settings to:
SET ARDUINO_PATH=C:\Users\cmaglie\Desktop\arduino-1.6.0rc2
SET ARDUINO_PR_BUILD_PATH=C:\Users\cmaglie\Desktop\arduino-PR-2301-BUILD-123
SET_CONFLICTING_JNA_PATH=C:\jna
  1. everything works fine (the IDE starts 4 times, with and without the path and with and without the patch!)

Are you sure that is jnidispatch.dll that is causing the problem?

@cmaglie cmaglie self-assigned this Jan 18, 2015
@pfeerick
Copy link
Contributor

Hi @cmaglie

All I can say to that is that jnadispatch.dll (the version I gave you)
is the only file in that folder, and when it is in the path... things go
wrong, and when it isn't, everything is fine. All I can suggest is that
there is another requirement to trigger the issue. I am running Windows
7 SP1 x32, and am running Java 8u25 as the system JRE. I am running
BitDefender IS antivirus, but the issue started up long before I
installed that.

If I get a chance tomorrow, I'll provision a fresh Virtual Machine and
try to debug further. Any suggestions you can make as to where to go
next would be appreciated, otherwise we might have to chalk this up as
unresolvable for now.

Peter

On 19/01/2015 12:04 AM, Cristian Maglie wrote:

Hi @pfeerick https://github.com/pfeerick

I'm having hard times to reproduce the issue, on my system the IDE
always starts without problems...

What I've done is:

  1. I've copied your jnidispatch.dll into C:\jna
  2. In your batch file I've changed the settings to:

|SET ARDUINO_PATH=C:\Users\cmaglie\Desktop\arduino-1.6.0rc2
SET ARDUINO_PR_BUILD_PATH=C:\Users\cmaglie\Desktop\arduino-PR-2301-BUILD-123
SET_CONFLICTING_JNA_PATH=C:\jna
|

  1. everything works fine (the IDE starts 4 times, with and without the
    patch and with and without the patch!)

Are you sure that is |jnidispatch.dll| that is causing the problem?


Reply to this email directly or view it on GitHub
#2301 (comment).

@cmaglie cmaglie modified the milestones: Release 1.6.0, Release 1.6.1 Feb 18, 2015
@cmaglie cmaglie added Type: Bug Component: IDE user interface The Arduino IDE's user interface labels Apr 15, 2015
@ffissore ffissore assigned ffissore and unassigned cmaglie May 12, 2015
@ffissore ffissore closed this in e7fc9a1 May 19, 2015
@ffissore
Copy link
Contributor

Setting -Djna.nosys=true seems like a good idea anyway. Plus, much of the native code in Platform has been removed. @pfeerick are you still having the issue with the latest hourly build? (I've just pushed the commit, wait an hour or so)

@pfeerick
Copy link
Contributor

@ffissore Still no satisfaction. I'm on Windows 7 x64 now, and tried my old test of including a different version of the jnidispatch.dll in the path before starting the Arduino IDE, and it breaks again. (which is how I came to find the problem, a newly installed program had added itself to the system path, and the jnidispatch.dll was newer than the Arduino IDEs, and wasn't compatible). Error message has changed slightly.

This is the dll I was using : https://dl.dropboxusercontent.com/u/190356/jnidispatch.dll
And this is the test script I use : https://dl.dropboxusercontent.com/u/190356/arduino%20JNA%20test.cmd

I run a control test of a old(er) IDE and a new test IDE with a clean path, to ensure no gremlins.
I then run the old(er) IDE and the new test IDE again, but with the jnidispatch.dll folder in the path as well. Guaranteed fail every time for my systems so far...

Start Arduino 1.5.8 Debug (w/ BAD JNA) ...

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
        at com.sun.jna.Native.pointerSize(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:93)
        at processing.app.windows.Platform.<clinit>(Platform.java:286)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at processing.app.Base.initPlatform(Base.java:269)
        at processing.app.Base.main(Base.java:139)

Start Arduino 1.6.4 Debug (w/ BAD JNA) ...

Loading configuration...
java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
        at com.sun.jna.Native.pointerSize(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:93)
        at processing.app.windows.Advapi32.<clinit>(Advapi32.java:21)
        at processing.app.windows.Registry.getStringValue(Registry.java:115)
        at processing.app.windows.Platform.checkAssociations(Platform.java:70)
        at processing.app.windows.Platform.init(Platform.java:59)
        at processing.app.Base.<init>(Base.java:254)
        at processing.app.Base.guardedMain(Base.java:215)
        at processing.app.Base.main(Base.java:128)

Start Arduino Hourly 1.6.5 2015/05/19 09:13 Debug (w/ BAD JNA) ...

Loading configuration...
java.lang.UnsatisfiedLinkError: com.sun.jna.Native.pointerSize()I
        at com.sun.jna.Native.pointerSize(Native Method)
        at com.sun.jna.Native.<clinit>(Native.java:93)
        at processing.app.windows.Advapi32.<clinit>(Advapi32.java:21)
        at processing.app.windows.Registry.getStringValue(Registry.java:115)
        at processing.app.windows.Platform.getSettingsFolder(Platform.java:193)
        at processing.app.BaseNoGui.getSettingsFolder(BaseNoGui.java:287)
        at processing.app.BaseNoGui.getSettingsFile(BaseNoGui.java:272)
        at processing.app.PreferencesData.init(PreferencesData.java:38)
        at processing.app.BaseNoGui.initParameters(BaseNoGui.java:946)
        at processing.app.Base.guardedMain(Base.java:151)
        at processing.app.Base.main(Base.java:131)

@ffissore
Copy link
Contributor

I suppose the only other way to solve this problem is updating jna, which I've started doing a while ago (branch is here), although it's not even compiling ATM. I've opened #3190

@ffissore ffissore modified the milestones: Release 1.6.1, Release 1.6.5 May 20, 2015
@ffissore
Copy link
Contributor

@ArduinoBot is baking this PR #3194

facchinm added a commit to facchinm/Arduino that referenced this pull request Jul 4, 2016
reapply patch arduino#2301
this patch got lost with f6546ae and its partial revert 98eb1a9

Should fix arduino#5092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants