Unable to start daemon without Internet access

644 views
Skip to first unread message

Alex Ruiz

unread,
Nov 12, 2014, 1:06:47 PM11/12/14
to gradl...@googlegroups.com
Greetings,

When using Android Studio with Gradle 2.2 and *turning Wi-Fi* off on my laptop I get the following error:

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
10:01:34.373 [main] DEBUG o.g.l.daemon.bootstrap.DaemonMain - Assuming the daemon was started with following jvm opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]
10:01:34.786 [main] DEBUG o.g.l.daemon.server.DaemonServices - Creating daemon context with opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]
10:01:34.852 [INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=513b4cbb-8751-4fca-ad66-c0080dae9d55,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home,daemonRegistryDir=/Users/alruiz/.gradle/daemon,pid=76643,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
10:01:34.862 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1415815294862
10:01:34.871 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo0
10:01:34.872 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
10:01:34.873 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
10:01:34.874 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Ignoring remote address on loopback interface /fe80:0:0:0:0:0:0:1%1
10:01:34.874 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
10:01:34.876 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
10:01:34.877 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback multicast interface lo0
10:01:34.896 [ERROR] [system.err] 
10:01:34.897 [ERROR] [system.err] FAILURE: Build failed with an exception.
10:01:34.898 [ERROR] [system.err] 
10:01:34.899 [ERROR] [system.err] * What went wrong:
10:01:34.900 [ERROR] [system.err] Could not determine the a usable local IP for this machine.
10:01:34.900 [ERROR] [system.err] 
10:01:34.901 [ERROR] [system.err] * Try:
10:01:34.902 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
10:01:34.905 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: null
10:01:34.919 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
10:01:34.925 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
10:01:34.962 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

Doing the same with Gradle 2.1 works fine.

Having the ability to work in Android Studio offline is quite important to us. Is there anything we can do on our side to resolve this (we strongly prefer not to set the --offline flag).

Thanks,
-Alex

Adam Murdoch

unread,
Nov 12, 2014, 2:57:54 PM11/12/14
to gradl...@googlegroups.com
Hi,

I suspect it’s something about your particular machine, as I can use the tooling API to start a 2.2 daemon with wifi switched off on my machine.

It would be good to get the stack trace of the failure. It’s kind of tricky to get the daemon startup failure. The simplest thing might be to run the `test` task for a Gradle build using Gradle 2.2 with the wifi switched off to see if you get the same failure, as this will exercise the same code that is failing in the daemon.


--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/CABUGdo96K%2BF4%2BwQkj3PjQtyo9Q9byvujscfPoubPEn0wok4UJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
CTO Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com



Alex Ruiz

unread,
Nov 12, 2014, 3:04:29 PM11/12/14
to gradl...@googlegroups.com
Thanks, Adam. I will give it a try.

Regards,
-Alex

Alex Ruiz

unread,
Nov 12, 2014, 3:50:53 PM11/12/14
to gradl...@googlegroups.com
Hi Adam,

I think I narrowed down how to reproduce this issue. Gradle 2.2 works fine without Wi-Fi on my machine, but the moment I delete ~/.gradle or ~/.gradle/daemon and try again, it throws the error.

I got this stack trace:

org.gradle.api.GradleException: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.2/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
12:46:36.135 [main] DEBUG o.g.l.daemon.bootstrap.DaemonMain - Assuming the daemon was started with following jvm opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]
12:46:36.581 [main] DEBUG o.g.l.daemon.server.DaemonServices - Creating daemon context with opts: [-XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]
12:46:36.661 [INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=dc2eda3c-b6ab-4301-9307-e656303239f4,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home,daemonRegistryDir=/Users/alruiz/.gradle/daemon,pid=86914,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
12:46:36.675 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1415825196675
12:46:36.695 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo0
12:46:36.696 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
12:46:36.697 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
12:46:36.698 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Ignoring remote address on loopback interface /fe80:0:0:0:0:0:0:1%1
12:46:36.699 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
12:46:36.700 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
12:46:36.701 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback multicast interface lo0
12:46:37.126 [ERROR] [system.err] 
12:46:37.128 [ERROR] [system.err] FAILURE: Build failed with an exception.
12:46:37.128 [ERROR] [system.err] 
12:46:37.129 [ERROR] [system.err] * What went wrong:
12:46:37.130 [ERROR] [system.err] Could not determine the a usable local IP for this machine.
12:46:37.130 [ERROR] [system.err] 
12:46:37.131 [ERROR] [system.err] * Try:
12:46:37.131 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
12:46:37.134 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: null
12:46:37.146 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
12:46:37.151 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
12:46:37.192 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

at org.gradle.launcher.daemon.bootstrap.DaemonGreeter.parseDaemonOutput(DaemonGreeter.java:35)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startProcess(DefaultDaemonStarter.java:112)
at org.gradle.launcher.daemon.client.DefaultDaemonStarter.startDaemon(DefaultDaemonStarter.java:93)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:105)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:82)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:115)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:75)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:42)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:54)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:31)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:107)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:94)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:152)
at org.gradle.tooling.internal.consumer.connection.CancellableModelBuilderBackedModelProducer.produceModel(CancellableModelBuilderBackedModelProducer.java:50)
at org.gradle.tooling.internal.consumer.connection.GradleBuildAdapterProducer.produceModel(GradleBuildAdapterProducer.java:42)
at org.gradle.tooling.internal.consumer.connection.BuildInvocationsAdapterProducer.produceModel(BuildInvocationsAdapterProducer.java:44)
at org.gradle.tooling.internal.consumer.connection.ModelBuilderBackedConsumerConnection.run(ModelBuilderBackedConsumerConnection.java:62)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:82)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:76)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:88)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)

Is this stack trace helpful? If not, please let me know how I can gather more info :-)

Many thanks!
-Alex

Alex Ruiz

unread,
Nov 12, 2014, 3:51:35 PM11/12/14
to gradl...@googlegroups.com
I forgot to mention, if I delete ~/.gradle with Wi-Fi on, Gradle never throws the error.

Alex Ruiz

unread,
Nov 12, 2014, 8:13:21 PM11/12/14
to gradl...@googlegroups.com
Hi Adam,

I asked my teammates to try to reproduce this issue and we found something interesting:

1. It happens only on Macs. We tried on Linux without network and this issue does not reproduce.
2. Only happens if ~/.gradle is missing, or ~/.gradle/daemon
3. It doesn't happen when running "test"

And we think we found where the error is thrown. Here are the details:
We ran this command on Mac, with Wi-Fi disabled:

java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/alruiz/Downloads/Android\ Studio.app/Contents/gradle/gradle-2.2/lib/gradle-launcher-2.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 2.2 /Users/alruiz/.gradle/daemon 10800000 db8f618d-675e-48c5-b206-23ea69ffaef9 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant

which is similar to the one that launches the daemons. It failed on Mac without Wi-Fi with this error:

[INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=db8f618d-675e-48c5-b206-23ea69ffaef9,javaHome=/Library/Third Party Plugins/JavaAppletPlugin.plugin/Contents/Home,daemonRegistryDir=/Users/alruiz/.gradle/daemon,pid=97821,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant,--stacktrace,--debug]

16:59:12.943 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1415840352943
16:59:12.951 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo0
16:59:12.951 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
16:59:12.952 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a multicast interface? true
16:59:12.952 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Ignoring remote address on loopback interface /fe80:0:0:0:0:0:0:1%1
16:59:12.953 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
16:59:12.954 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
16:59:12.954 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback multicast interface lo0
16:59:12.961 [ERROR] [system.err]
16:59:12.962 [ERROR] [system.err] FAILURE: Build failed with an exception.
16:59:12.963 [ERROR] [system.err]
16:59:12.963 [ERROR] [system.err] * What went wrong:
16:59:12.964 [ERROR] [system.err] Could not determine the a usable local IP for this machine.
16:59:12.964 [ERROR] [system.err]
16:59:12.964 [ERROR] [system.err] * Try:
16:59:12.965 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
16:59:12.967 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: null
16:59:12.976 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
16:59:12.980 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
16:59:12.993 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.

And we looked at the code and that error is thrown by InetAddressFactory#findLocalBindingAddress, which is new in Gradle 2.2.

Is this info enough to troubleshoot the issue?

Thanks!
-Alex

Szczepan Faber

unread,
Nov 13, 2014, 4:26:59 AM11/13/14
to gradl...@googlegroups.com
Hey guys,

I can consistently reproduce the issue when I use daemon with java7
and I'm not connected to any wifi network. I've received reports from
my client that other people have this issue, too. I've raised a jira
ticket with all the details:
https://issues.gradle.org/browse/GRADLE-3194

Our current workaround is: a) be connected to wifi network or b) use
different java version different than 7

BTW. When I hack the code the ignore exception coming from
InetAddress.getLocalHost() the build works for me.

Cheers!

On Thu, Nov 13, 2014 at 2:13 AM, 'Alex Ruiz' via gradle-dev
> https://groups.google.com/d/msgid/gradle-dev/CABUGdo-NWk2pkd6ogC%2B49x%3DYArGgMW43xRDjXO6yYPsLZUWhBw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Szczepan Faber
Core dev@gradle; Founder@mockito

Adam Murdoch

unread,
Nov 13, 2014, 6:50:15 PM11/13/14
to gradl...@googlegroups.com
Thanks for the jira ticket. Very useful.

I’ve pushed a fix to the release branch. @Szczepan, @Alex could you test this out and let us know if the problem is fixed for you?


Thanks.


For more options, visit https://groups.google.com/d/optout.

Szczepan Faber

unread,
Nov 14, 2014, 8:19:42 AM11/14/14
to gradl...@googlegroups.com
I've tested release branch (at
47346a8af6861f15956d19d850d05cf19f7bf860 - from the log it looks like
your fix is included) and the problem still persists when I switch off
the wifi. Debug log + stack trace:
https://gist.github.com/szczepiq/c98f9cc2f3ce856c24fe

Hope that helps!

On Fri, Nov 14, 2014 at 12:50 AM, Adam Murdoch
> https://groups.google.com/d/msgid/gradle-dev/D2A4833E-F584-4B74-BD53-CC4F0FFF45BE%40gradleware.com.

Alex Ruiz

unread,
Nov 14, 2014, 12:23:52 PM11/14/14
to gradl...@googlegroups.com
Thanks, Adam & Szczepan. I'm also going to give it a try from inside Android Studio.

Alex Ruiz

unread,
Nov 14, 2014, 1:57:54 PM11/14/14
to gradl...@googlegroups.com
Adam & Szczepan,

I built Gradle from the 'release' branch and tried with Android Studio. The bug seems fixed!

As always, thanks a lot for your help!

-Alex 

Adam Murdoch

unread,
Nov 14, 2014, 2:00:38 PM11/14/14
to gradl...@googlegroups.com
On 15 Nov 2014, at 12:19 am, Szczepan Faber <szcz...@gmail.com> wrote:

I've tested release branch (at
47346a8af6861f15956d19d850d05cf19f7bf860 - from the log it looks like
your fix is included) and the problem still persists when I switch off
the wifi. Debug log + stack trace:
https://gist.github.com/szczepiq/c98f9cc2f3ce856c24fe

That failure's in your code. It got past the original problem.



For more options, visit https://groups.google.com/d/optout.

Szczepan Faber

unread,
Nov 15, 2014, 7:26:47 AM11/15/14
to gradl...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages