ReadYouApp / ReadYouApp/ReadYou

UnknownHostException leads to error screen

Open
#860 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
7.5k
Forks
330
PR merge metrics
No merged PRs in 30d

Description

1. Environment

Version: 0.10.1
Device: Xiaomi 2201123G
System: Android 14 (API 34)

2. Describe the bug

I currently use Tailscale to connect to my NAS by hostname ("nas") – this leads to the app crashing when Tailscale isn't turned on.

I'd propose catching the exception (or network exceptions in general) and displaying something like a toast notification about the connection failure.

Version: 0.10.1
Device: Xiaomi 2201123G
System: Android 14 (API 34)

Stack trace: 

java.net.UnknownHostException: Unable to resolve host "nas": No address associated with hostname
	at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
	at java.net.InetAddress.getAllByName(InetAddress.java:1152)
	at okhttp3.Dns$Companion$DnsSystem.lookup(Dns.kt:6)
	at okhttp3.internal.connection.RealRoutePlanner.plan(RealRoutePlanner.kt:469)
	at okhttp3.internal.connection.FastFallbackExchangeFinder.launchTcpConnect(FastFallbackExchangeFinder.kt:10)
	at okhttp3.internal.connection.FastFallbackExchangeFinder.find(FastFallbackExchangeFinder.kt:61)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:1015)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:139)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:174)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:96)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
	at java.lang.Thread.run(Thread.java:1012)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3245efc, Dispatchers.IO]
Caused by: android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
	at libcore.io.Linux.android_getaddrinfo(Native Method)
	at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
	at libcore.io.BlockGuardOs.android_getaddrinfo(BlockGuardOs.java:222)
	at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:133)
	at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:135)
	... 19 more

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the network call path shown in the stack trace, including okhttp3.Dns and the coroutine running on Dispatchers.IO, then locate the app code that surfaces connection failures. Reproduce the unreachable-host case and verify that the app stays open and displays a connection-failure message instead of crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.