Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while fetching network location from WIFIonICE moving wifi network #2704

Open
TimoWilken opened this issue Dec 27, 2024 · 3 comments · May be fixed by #2820
Open

Crash while fetching network location from WIFIonICE moving wifi network #2704

TimoWilken opened this issue Dec 27, 2024 · 3 comments · May be fixed by #2820
Labels

Comments

@TimoWilken
Copy link

TimoWilken commented Dec 27, 2024

Describe the bug

When on an ICE train in Germany and connected to the "WIFIonICE" network, I never get a network location from microG that is identical to the train's GPS location (as reported by the API).

To Reproduce

Steps to reproduce the behavior:

  1. Get on an ICE train (or stand next to one in a station?), connect to its WIFIonICE network and log into the network
  2. Start a logcat app, e.g. "Logcat Reader", and start recording messages
  3. Open any app that requests a location (e.g. a maps app)
  4. See error in logcat: "Failed retrieving location for current moving wifi WIFIonICE: java.net.SocketException: Binding socket to network 101 failed: EPERM (Operation not permitted)" (see traceback below)

Expected behavior

I expect the maps app to show my location identical with the train's location almost immediately, with an appropriate accuracy (judging by microG code, that would be 100m).

Screenshots

N/A

System

  • Android Version: 14 (AP2A.240905.003)
  • Custom ROM: LineageOS 21-20241211-microG-FP4 (from lineage.microg.org)
  • microG Services app: 0.3.6.244735 (244735012), from microG F-Droid repo

Additional context

Failed retrieving location for current moving wifi WIFIonICE
java.net.SocketException: Binding socket to network 101 failed: EPERM (Operation not permitted)
	at android.net.Network.bindSocket(Network.java:442)
	at android.net.Network.bindSocket(Network.java:409)
	at android.net.Network$NetworkBoundSocketFactory.createSocket(Network.java:269)
	at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:114)
	at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
	at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
	at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:30)
	at org.microg.gms.location.network.wifi.MovingWifiHelper$retrieveMovingLocation$2.invokeSuspend(MovingWifiHelper.kt:140)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: android.system.ErrnoException: Binding socket to network 101 failed: EPERM (Operation not permitted)
	at android.net.Network.bindSocket(Network.java:441)
	... 22 more
@TimoWilken TimoWilken added the bug label Dec 27, 2024
@TimoWilken
Copy link
Author

Hi, I've upgraded to LineageOS 22.1, but unfortunately this issue still occurs in exactly the same way with the same traceback as before.

My new system information is:

  • Android Version: 15 (AP4A.250105.002)
  • Custom ROM: LineageOS 22.1-20250112-microG-FP4 (from lineage.microg.org)
  • microG Services app: 0.3.6.244735 (244735012), from microG F-Droid repo

@mar-v-in
Copy link
Member

microG tries to directly bind to the network interface of the wifi. This is so that if you are connected to a wifi hotspot and also mobile network, and Android decides to route regular traffic through the mobile network for any reason (e.g. because you did not sign in on the wifi hotspot's captive portal yet), microG would still route the request to the wifi so it can provide a response.

If you set up a VPN and force all connections to be routed through the VPN software (even if the VPN software decides to route the traffic not through the VPN but to the network directly), this binding to network interface fails.

As a work-around, we can try to detect this situation and then not bind to a specific interface.

@TimoWilken
Copy link
Author

Thank you for that @mar-v-in! Since I have the WireGuard app installed, which provides a VPN. It's currently set to "Always-on", but "Block connections without VPN" is disabled in the Android VPN settings.

I'll try fiddling with that this weekend, to see if it solves the error. (Obviously, it would still be good to be able to leave the VPN enabled, but I can live with turning it off manually when I'm on a train.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants