You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our app's backend event logs, we are seeing ConnectError with code .unknown quite frequently. This seems to occur when the user starts an app session (app becomes foregrounded) but then doesn't do anything for a while. Then, as soon as a gRPC request is made (checkAuthStatus) we see the error.
Here are some screenshots:
Coming back after 2 hours
Coming back after 5 minutes
The error does not tell us anything except that the code is .unknown. Is this due to the gRPC pool timing out? Is there something we can do to refresh the gRPC session?
Btw, here's the code that we have to check auth status every 30 min:
func continuouslyCheckAuthStatus(){lettimer=Timer.scheduledTimer(withTimeInterval:1800, repeats:true){[weak self] _ inself?.performTask()}
// Add the timer to the current run loop
RunLoop.current.add(timer, forMode:.common)}
// called every 30 minutes
func performTask(){checkAuthStatus()}
👋🏽 hey @aheze, thanks for flagging this. Can you share more details on what checkAuthStatus() is doing? Is it a unary request? Do you open gRPC streams or send any other requests when the user opens the app? (In other words, is the request returning .unknown the first request your app sends?) I'm also curious to know if the error's message has any info?
I think the NIO connection may be timing out / disconnecting while the app is backgrounded and your timer expires before the user foregrounds the app. Since the OS won't send the request after the app has been backgrounded for minutes, when the user foregrounds the app the OS tries to send the request but the connection is dead. Based on this code and where it's used, retrying the request should reconnect it and send the request over the new connection.
👍🏽 I'd definitely advise using Connect + URLSession if you don't strictly need to use the gRPC protocol - it's simpler and will also reduce your binary size.
If you want to debug further, the next steps I'd suggest are:
See if you can get any useful information out of ConnectError.message when the failure arises
Consider using a recent commit from Connect-Swift which includes this change, as it may give you a more helpful status depending on what the underlying error is
Consider implementing retries (you can do this inside of a Connect interceptor)
If possible, see if the issue persists with Connect + URLSession
In our app's backend event logs, we are seeing
ConnectError
with code.unknown
quite frequently. This seems to occur when the user starts an app session (app becomes foregrounded) but then doesn't do anything for a while. Then, as soon as a gRPC request is made (checkAuthStatus
) we see the error.Here are some screenshots:
The error does not tell us anything except that the code is
.unknown
. Is this due to the gRPC pool timing out? Is there something we can do to refresh the gRPC session?Btw, here's the code that we have to check auth status every 30 min:
We are using gRPC:
The text was updated successfully, but these errors were encountered: