Opened 3 weeks ago

Last modified 5 days ago

#31293 new defect

tor-android-service gradle failure when probing network interfaces

Reported by: sysrqb Owned by: tbb-team
Priority: High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-rbm
Cc: sisbell, pospeselr Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

When building nightly android-aarch64 and android-x86 (I haven't tried the other platforms), the build fails on tor-android-service with:

Starting build: Tue Jul 30 16:12:53 2019
patching file build.gradle
patching file service/build.gradle
patching file service/src/main/java/org/torproject/android/service/TorService.java
Hunk #2 succeeded at 99 (offset 3 lines).

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine a usable local IP for this machine.

The failure is on the gradle command:

# Build Android Libraries and Apps
$GRADLE_HOME/gradle-4.1/bin/gradle --offline -P androidplugin=3.0.1 -P appcompatVersion=23.4.0 -P compileVersion=26 -P targetVersion=26 -P minVersion=16 assembleRelease -x lint

Child Tickets

Change History (12)

comment:1 Changed 3 weeks ago by sysrqb

To be clear, it's entirely possible this is a weirdness on my computer.

The stacktrace contains:

22:17:26.533 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: /var/tmp/dist/android-toolchain/gradle/native
22:17:26.672 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build 8e417a9a-6c6c-4e4f-8b22-d6f2eb3b862b.1 in daemon client {pid=30}
22:17:26.681 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
22:17:26.682 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
22:17:26.683 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
22:17:26.683 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
22:17:26.684 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not determine a usable local IP for this machine.
22:17:26.685 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
22:17:26.685 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
22:17:26.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] java.lang.RuntimeException: Could not determine a usable local IP for this machine.
22:17:26.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.remote.internal.inet.InetAddressFactory.getLocalBindingAddress(InetAddressFactory.java:89)
22:17:26.687 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.cache.internal.FileLockCommunicator.<init>(FileLockCommunicator.java:47)
22:17:26.688 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler.getCommunicator(DefaultFileLockContentionHandler.java:153)
[snip]
22:17:26.698 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.NullPointerException
22:17:26.698 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.remote.internal.inet.InetAddresses.analyzeNetworkInterfaces(InetAddresses.java:49)
22:17:26.699 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.remote.internal.inet.InetAddresses.<init>(InetAddresses.java:40)
22:17:26.699 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.remote.internal.inet.InetAddressFactory.init(InetAddressFactory.java:100)
22:17:26.699 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.gradle.internal.remote.internal.inet.InetAddressFactory.getLocalBindingAddress(InetAddressFactory.java:85)
22:17:26.699 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   ... 31 more

I found https://github.com/Microsoft/WSL/issues/850, but that sounded like it was WSL specific and it was from three years ago.

comment:2 Changed 3 weeks ago by sisbell

Try this solution

-Djava.net.preferIPv4Stack=true

https://forums.developer.apple.com/thread/91237

comment:3 in reply to:  2 Changed 3 weeks ago by sysrqb

Replying to sisbell:

Try this solution

-Djava.net.preferIPv4Stack=true

https://forums.developer.apple.com/thread/91237

Thanks! These seem a little different, (NullPointerException vs. java.net.SocketException: Operation not permitted (ioctl SIOCGIFNETMASK_IN6 failed))

But no luck here:

patching file build.gradle
patching file service/build.gradle
patching file service/src/main/java/org/torproject/android/service/TorService.java
Hunk #2 succeeded at 99 (offset 3 lines).
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine a usable local IP for this machine.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

comment:4 Changed 3 weeks ago by sisbell

Try not using a daemon in the gradle command. From your logs, it logs like the daemon is trying to connect to local IP address and failing

--no-daemon

comment:5 in reply to:  4 Changed 3 weeks ago by sysrqb

Replying to sisbell:

Try not using a daemon in the gradle command. From your logs, it logs like the daemon is trying to connect to local IP address and failing

--no-daemon

I'm trying this now. I'll also note I see the computer's network interface has multiple IPv6 addresses assigned to it. I'm not sure if this is an artifact of previous builds. If this doesn't work then I'll try rebooting.

comment:6 Changed 3 weeks ago by sysrqb

Hrm. I think I'll try restarting.

Starting build: Tue Jul 30 17:37:44 2019
patching file build.gradle
patching file service/build.gradle
patching file service/src/main/java/org/torproject/android/service/TorService.java
Hunk #2 succeeded at 99 (offset 3 lines).
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.1/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* What went wrong:
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 https://docs.gradle.org/4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

comment:7 Changed 10 days ago by gk

Cc: pospeselr added
Keywords: tbb-rbm added
Priority: MediumHigh

It seems pospeselr ran into something similar as well when building tor-onion-proxy-library-android for armv7.

comment:8 Changed 10 days ago by pospeselr

My error log for the record:

Starting build: Wed Aug  7 04:48:42 2019
patching file android/build.gradle
patching file android_tor_installer/build.gradle
patching file build.gradle
patching file universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java
patching file universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfig.java

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine a usable local IP for this machine.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

This is happening on a brand new install of Linux Mint, apt installed all the dependencies in rbm's main README. I'll update after a re-run with --stacktrace enabled.

EDIT: looks like I'm getting the same error as sysrqb, currently bisecting to see when this issue was introduced.

Last edited 10 days ago by pospeselr (previous) (diff)

comment:9 Changed 10 days ago by pospeselr

I get the same error all the way back to aa321fb6bca0a5b9fffd6f92053100aad6ab2679 when tor-onion-proxy-library was introduced.

comment:10 Changed 6 days ago by sisbell

I wasn't able to reproduce this with older versions, but it just started up with the very latest of master.

What I found was that is I added 'ip addr show' in the build script prior to running the gradle command, there is only one interface, the loopback and it is in a DOWN state.

1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

When gradle starts, it throws an NPE due to not finding an interface.

I tried sleeping the build for up to 5 minutes prior to running gradle but the lo interface was still down.

I went through the rbm.conf files and project config back through April and didn't see any changes that would appear to cause this behavior.

The debug shell shows everything as normal

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

So what I can determine is:

  • Its not an IPv6 issue. It appears the lo interface is not coming up on start of the container
  • It is not a gradle issue

comment:11 Changed 5 days ago by sisbell

The build failure occurs with gradle 4.1. With Gradle 4.10 (which we are using for esr68) gradle assigns a default 127.0.0.1 value if it is unable to query the interface. So it doesn't thrown an NPE and moves along happily.

comment:12 Changed 5 days ago by sisbell

May be caused by this issue: #25623 . Try enabling network and see if it fixes the problem.

Note: See TracTickets for help on using tickets.