WARNING: Linux JNA-based affinity not usable because it failed to load! Reason: java.lang.ExceptionInInitializerError

178 views
Skip to first unread message

Mike Bundy

unread,
Jan 12, 2016, 12:47:57 PM1/12/16
to Chronicle
I am having the following problem running on Ubuntu 15.10 Workstation under VMWare 12.  The exception is thrown on my first call to startExcerpt().  Same code runs fine on a bare metal host running Ubuntu 15.10 Server.

Jan 12, 2016 7:09:58 AM net.openhft.affinity.Affinity logThrowable
WARNING: Linux JNA-based affinity not usable because it failed to load! Reason: java.lang.ExceptionInInitializerError
at net.openhft.affinity.Affinity.isLinuxJNAAffinityUsable(Affinity.java:112)
at net.openhft.affinity.Affinity.<clinit>(Affinity.java:51)
at net.openhft.affinity.AffinitySupport.getThreadId(AffinitySupport.java:28)
at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:613)
at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:605)
at com.fxone.common.io.HftSession.sendMessage(HftSession.java:164)
at com.fxone.common.io.HftChannel.sendMessage(HftChannel.java:156)
at com.fxone.common.io.MessageTransport.sendMessage(MessageTransport.java:148)
at com.fxone.common.io.MessageProxy.sendMessage(MessageProxy.java:378)
at com.fxone.reef.servers.Scheduler.open(Scheduler.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.fxone.common.admin.ReflectionCommand.doExecute(ReflectionCommand.java:339)
at com.fxone.common.admin.ReflectionCommand.executeIn(ReflectionCommand.java:218)
at com.fxone.common.admin.CommandManager.execute(CommandManager.java:226)
at com.fxone.common.admin.LoadFileCommand.loadConfig(LoadFileCommand.java:48)
at com.fxone.reef.Main.main(Main.java:76)
Caused by: java.lang.IllegalStateException: sched_getaffinity(0, (8) , cpuset) failed; errno=22
at net.openhft.affinity.impl.LinuxHelper.sched_getaffinity(LinuxHelper.java:220)
at net.openhft.affinity.impl.LinuxJNAAffinity.getAffinity(LinuxJNAAffinity.java:38)
at net.openhft.affinity.impl.LinuxJNAAffinity.<clinit>(LinuxJNAAffinity.java:137)
... 19 more
Caused by: com.sun.jna.LastErrorException: [22] h#
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at net.openhft.affinity.impl.$Proxy3.sched_getaffinity(Unknown Source)
at net.openhft.affinity.impl.LinuxHelper.sched_getaffinity(LinuxHelper.java:215)
... 21 more

Jan 12, 2016 7:09:58 AM net.openhft.affinity.Affinity logThrowable
WARNING: Posix JNA-based affinity not usable because it failed to load! Reason: java.lang.ExceptionInInitializerError
at net.openhft.affinity.Affinity.isPosixJNAAffinityUsable(Affinity.java:98)
at net.openhft.affinity.Affinity.<clinit>(Affinity.java:55)
at net.openhft.affinity.AffinitySupport.getThreadId(AffinitySupport.java:28)
at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:613)
at net.openhft.chronicle.VanillaChronicle$VanillaAppenderImpl.startExcerpt(VanillaChronicle.java:605)
at com.fxone.common.io.HftSession.sendMessage(HftSession.java:164)
at com.fxone.common.io.HftChannel.sendMessage(HftChannel.java:156)
at com.fxone.common.io.MessageTransport.sendMessage(MessageTransport.java:148)
at com.fxone.common.io.MessageProxy.sendMessage(MessageProxy.java:378)
at com.fxone.reef.servers.Scheduler.open(Scheduler.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.fxone.common.admin.ReflectionCommand.doExecute(ReflectionCommand.java:339)
at com.fxone.common.admin.ReflectionCommand.executeIn(ReflectionCommand.java:218)
at com.fxone.common.admin.CommandManager.execute(CommandManager.java:226)
at com.fxone.common.admin.LoadFileCommand.loadConfig(LoadFileCommand.java:48)
at com.fxone.reef.Main.main(Main.java:76)
Caused by: java.lang.IllegalStateException: sched_getaffinity((4) , &(allocated@0x7f67006509f0 (4 bytes) (com.sun.jna.ptr.IntByReference@658957)) ) errorNo=22
at net.openhft.affinity.impl.PosixJNAAffinity.getAffinity(PosixJNAAffinity.java:89)
at net.openhft.affinity.impl.PosixJNAAffinity.<clinit>(PosixJNAAffinity.java:249)
... 19 more
Caused by: com.sun.jna.LastErrorException: [22] ðw
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at net.openhft.affinity.impl.$Proxy4.sched_getaffinity(Unknown Source)
at net.openhft.affinity.impl.PosixJNAAffinity.getAffinity(PosixJNAAffinity.java:78)
... 20 more

Peter Lawrey

unread,
Jan 12, 2016, 3:33:13 PM1/12/16
to java-ch...@googlegroups.com
You should note that CPU binding on a virtual machine won't do anything useful as you are not binding to a real cpu in any case. Never the less it shouldn't report this error either.

What we can do is treat errorno 22 (Invalid mode) to disable thread affinity.

--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Bundy

unread,
Jan 18, 2016, 12:23:30 PM1/18/16
to Chronicle
It does finish with:
...
INFO: Using dummy affinity control implementation

But no queue is created, no excerpt written.  

The only reason we use VMWare is for our development workstations (to test across multiple os's).  Any suggestions for getting the dummy affinity control to work?

Thanks,
Mike

Peter Lawrey

unread,
Jan 18, 2016, 5:44:40 PM1/18/16
to java-ch...@googlegroups.com
A work around we use is only use the Affinity library when it is enabled on the command line through a System property you define.

Mike Bundy

unread,
Feb 9, 2016, 9:26:20 AM2/9/16
to Chronicle
Figured it out.  Simply set vcpu.hotadd = "FALSE" in the VMWare VMX file.

Mike
Reply all
Reply to author
Forward
0 new messages