6

I use Firestore for my Flutter app.

When I disable internet connection on emulator, this error appears on the console:

V/NativeCrypto( 6278): Read error: ssl=0xa4621708: I/O error during system call, Software caused connection abort
W/zzaeo   ( 6278): [{0}] Failed to resolve name. status={1}
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
V/NativeCrypto( 6278): Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf   ( 6278): Failed closing connection
W/zzajf   ( 6278): javax.net.ssl.SSLException: Write error: ssl=0xa4621708: I/O error during system call, Broken pipe
W/zzajf   ( 6278):  at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_write(Native Method)
W/zzajf   ( 6278):  at com.google.android.gms.org.conscrypt.SslWrapper.write(:com.google.android.gms@12529024@12.5.29 (040700-192802242):2)
W/zzajf   ( 6278):  at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLOutputStream.write(:com.google.android.gms@12529024@12.5.29 (040700-192802242):6)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzapc.write(Unknown Source:36)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzaot.write(Unknown Source:46)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzapf.close(Unknown Source:24)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzaku.close(Unknown Source:6)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzaim.run(Unknown Source:14)
W/zzajf   ( 6278):  at com.google.android.gms.internal.firebase-firestore.zzahi.run(Unknown Source:13)
W/zzajf   ( 6278):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W/zzajf   ( 6278):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/zzajf   ( 6278):  at java.lang.Thread.run(Thread.java:764)
W/zzaeo   ( 6278): [{0}] Failed to resolve name. status={1}
W/zzaeo   ( 6278): [{0}] Failed to resolve name. status={1}
W/zzaeo   ( 6278): [{0}] Failed to resolve name. status={1}

However, the app keeps running as usual after disconnection. I read about similar errors, and people say that it's a normal behavior and the error should be handled only if it is necessary to retry to make a connection.

Is that a normal behavior? Or if not, how should I handle it?

Darkhan
  • 2,888
  • 5
  • 20
  • 30
  • 1
    I was getting this error, did not notice that my device was disconnected. Thanks to your question, now I know the reason. – amishra May 19 '18 at 19:26

1 Answers1

0

You can perform a network check before calling your function for Firestore to avoid this exception. To check the network connectivity, I'll recommend you to use Connectivity package. Its pretty simple to use and works for both Android and iOS.

Jaswant Singh
  • 9,900
  • 8
  • 29
  • 50
  • Note that you should not be using the current network status for deciding whether you can reliably make a network connection. Always guard your app code against timeouts and errors that might come from the network layer. – Harsh Bhavsar Oct 04 '18 at 15:55