Started getting libnative-platform.so error running as non-root user

I’ve been running gradle 2.10 happily for a couple of months, working on a Oracle Linux 6u5 VM administered by IT. Last night everything was working fine and I was doing “gradle build” etc. as myself (my user is not root). This morning, I can’t even run “gradle --version” as it comes up with the error below. However I am able to run as root user by doing “sudo gradle --version”.

I am assuming some administrative change has been made that affects my user, but I would like some pointers as I have no idea what to look for.

$ gradle --version

  • Exception is:
    net.rubygrapefruit.platform.NativeException: Failed to load native library ‘libnative-platform.so’ for Linux amd64.
    at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:49)

    Caused by: java.io.IOException: No locks available
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)

Is your GRADLE_USER_HOME on a NFS mount? I think that’s a NFS error.

You could try… gradle -g /tmp --version to see if that makes it work (moves GRADLE_USER_HOME to /tmp for that invocation)

I am also facing the same issue, Tried you suggestion still the error.

Thankyou - that works for me. Not sure what I can do about it but will check with the IT team what has happened to my usual home directory!

$ gradle -g /tmp --version


Gradle 2.10

Build time: 2015-12-21 21:15:04 UTC
Build number: none
Revision: 276bdcded730f53aa8c11b479986aafa58e124a6

Groovy: 2.4.4
Ant: Apache Ant™ version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_65 (Oracle Corporation 25.65-b01)
OS: Linux 3.8.13-16.2.1.el6uek.x86_64 amd64

$ gradle --version

FAILURE: Build failed with an exception.

The original problem - no locks available - was finally resolved by dropping the .gradle directory and letting gradle recreate it. I wonder if the “No locks available” message was related to there being too many locks taken out within .gradle and not released? It does look more like it was a gradle problem than an NFS issue (NFS v3).

Edit: This was a short-lived “final” resolution as the problem resurfaced. Support have since discovered some major problems with the filer that my home directory is stored on. Looks to be a file system issue as you originally suggested.

I’d expect any running daemons to have died over night (the timeout is only 3 hours) and there wouldn’t be any process left to hold on to the locks.

Maybe deleting/re-creating the directory caused the nfs client or nfs daemon to decide there weren’t any lock problems after all?

Updated my last post with an edit - the problem resurfaced and on further investigation support found there is an underlying issue with the filer. Thanks for your replies on this.

I’m on RHEL6 and even Im hitting the same issue. Tried dropping the .gradle folder but no luck.

The issue you are seeing is likely related to the following: https://github.com/gradle/gradle/issues/1493