Bug 234593 - java/openjdk8: UnsatisfiedLinkError: sun.nio.ch.FileDispatcherImpl.allocate0
Summary: java/openjdk8: UnsatisfiedLinkError: sun.nio.ch.FileDispatcherImpl.allocate0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-03 16:08 UTC by Stefan Ehmann
Modified: 2019-01-18 00:48 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
Test program to reproduce the error (397 bytes, text/plain)
2019-01-03 16:08 UTC, Stefan Ehmann
no flags Details
A quick fix to fix the runtime error (1.15 KB, patch)
2019-01-03 19:13 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Ehmann 2019-01-03 16:08:03 UTC
Created attachment 200740 [details]
Test program to reproduce the error

Running the attached test program gives an error:

$ javac Test.java && java Test
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.nio.ch.FileDispatcherImpl.allocate0(Ljava/io/FileDescriptor;J)I
        at sun.nio.ch.FileDispatcherImpl.allocate0(Native Method)
        at sun.nio.ch.FileDispatcherImpl.allocate(FileDispatcherImpl.java:84)
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:909)
        at Test.main(Test.java:11)

There is an implementation for allocate0 in src/solaris/native/sun/nio/ch/FileDispatcherImpl.c. I guess it's only a problem with the build system.

I'm not 100% sure but I think the program that now throws this error used to work about a year ago.
Comment 1 Stefan Ehmann 2019-01-03 19:08:57 UTC
Seems to be a regression in 8u192. openjdk8-8.181.13_1 works fine.

A short note on the test program:
Make sure that the file "foo" does not exist before running the test.

If you test with 8u181 it creates the file with 1 byte. Afterwards, the error will not occur with 8u192 because the affected code path is only entered if the file needs to be expanded.
Comment 2 Jung-uk Kim freebsd_committer 2019-01-03 19:13:20 UTC
Created attachment 200746 [details]
A quick fix to fix the runtime error

It looks like the following commit was not correctly merged, i.e., jdk/make/mapfiles/libnio/mapfile-bsd:

http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/f64826e5b775

The easiest fix is using the attached patch.  However, the above commit was reverted later:

https://bugs.openjdk.java.net/browse/JDK-8202261

and fixed differently.

http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/a2361ab40be8
Comment 3 Jung-uk Kim freebsd_committer 2019-01-03 19:17:10 UTC
(In reply to Jung-uk Kim from comment #2)
I forgot to mention the attached patch replaces java/openjdk8/files/patch-jdk-make-mapfiles-libnio-mapfile-bsd.
Comment 4 Stefan Ehmann 2019-01-03 19:29:42 UTC
(In reply to Jung-uk Kim from comment #2)
Can confirm that there is no UnsatisfiedLinkError after applying the patch.
Thanks for the quick reply.
Comment 5 Jung-uk Kim freebsd_committer 2019-01-03 19:35:52 UTC
(In reply to Stefan Ehmann from comment #4)
Yes, the patch fixes the test program.
Comment 6 commit-hook freebsd_committer 2019-01-18 00:47:51 UTC
A commit references this bug:

Author: jkim
Date: Fri Jan 18 00:47:16 UTC 2019
New revision: 490617
URL: https://svnweb.freebsd.org/changeset/ports/490617

Log:
  Add a missing symbol in the linker map file.

  PR:		234593

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/patch-jdk-make-mapfiles-libnio-mapfile-bsd
Comment 7 Jung-uk Kim freebsd_committer 2019-01-18 00:48:42 UTC
I just went ahead and committed the patch.  Thanks!