-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix(mobile): ios random logout #8997
Conversation
Deploying immich with
|
Latest commit: |
a7c0451
|
Status: | ✅ Deploy successful! |
Preview URL: | https://70f6dd65.immich.pages.dev |
Branch Preview URL: | https://fix-mobile-random-logout.immich.pages.dev |
mobile/lib/modules/login/providers/authentication.provider.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Hopefully at a minimum the increased logging will help provide info.
Do we know why the 502 is getting hit / server is unreachable? From my external monitoring tools (which checks for both page content and HTTP return code) Immich Web and API endpoints are rock solid.
@mmomjian We don't. My guess is the internal timeout mechanism of the HTTP client. During my testing, I saw it returns 502 sometimes when the server is up and solid during the login process. I submitted the build for TestFlight, and we should be able to test this mechanism on your phones before merging it |
.get( | ||
Uri.parse(serverUrl), | ||
) | ||
.timeout(const Duration(seconds: 5)); | ||
|
||
if (response.statusCode == 502) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably do the opposite actually. If it isn't a 200, log the error and return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done; it never hit a valid GET endpoint, so it returned 404 or 512. I modify to use GET /server-info/ping to get a valid HTTP 200 when possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will $serverUrl contain the /api suffix even if not provided on the login screen? I know it works without it currently but im not sure where that gets added/checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmomjian it gets added if it is not included
fix #8146
The issue is in the method
_isEndpointAvailable
Even when the server is down, the get request can return a response with HTTP status code 502, which should be checked and handled similarly to TimoutException or SocketException to enter the offline mode.