-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2024-02-26][$500] [MEDIUM] Erroring thumbnail images try to reload infinitely #34601
Comments
Triggered auto assignment to @jliexpensify ( |
Update: I've started to be able to load data on production again, now behavior matches staging/dev. |
Hi @lindboe - cool, so all good here? Can I close this? |
@jliexpensify I'm not sure I understand the question? The original bug still exists, if you're referring to my update, note that in the original ticket production was breaking worse than the other environments for me, in that it refused to load at all, but now all environments have the issue of constantly attempting to reload the 404ing image. |
Sorry @lindboe I misread your comment as the issue was fixed. I'll re-review this and see if I can reproduce. EDIT: I don't know how to repro step 1, so asking here: https://expensify.slack.com/archives/C01SKUP7QR0/p1705458078466679 and here: https://expensify.slack.com/archives/C01GTK53T8Q/p1705532780265849 |
@tranvantoan-qn responded and can reproduce the |
Job added to Upwork: https://www.upwork.com/jobs/~010386784e89b6acc5 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
@jliexpensify Sorry, I'm not a developer (I used to be a test contributor when the program was still open to testers). However, I've experienced that trying to reproduce issues can sometimes be impossible due to different conditions, so using some support tools can be very helpful. If you want to know more about how to use these tools to mimic scenarios like this one, I'm happy to help. Once we can reproduce it, either in a normal way or by using the tool, I'm sure that we can fix it and verify the solution |
ProposalPlease re-state the problem that we are trying to solve in this issue.When an image cannot be loaded, requests are constantly being made. This can be easily (for now) reproduced when modifying the Distance request offline. The Distance receipt will be fixed in the #34287, but for now, it allows us to test this endless requests loop. What is the root cause of that problem?The root cause is in the
So the component is re-rendered each time the request fails, and the request is sent again. This creates a loop. What changes do you think we should make in order to solve the problem?Instead of building the source in-place, we should use the const source = useMemo(() => ({uri: url}), [url]); And use this Then, we should handle the fallback image.
To display this const hasFailedToLoadRef = useRef<boolean | null>(null);
const onError = () => {
Log.hmmm('Unable to fetch image to calculate size', {url});
hasFailedToLoadRef.current = true
}; Then, we'll need to alter the above-mentioned memo to handle the failed state: const source = useMemo(() => {
if (!hasFailedToLoadRef.current) {
return {uri: url};
}
if (isOffline) {
return OFFLINE_IMG;
}
return FALLBACK_BASED_ON_TYPE
}, [url, hasFailedToLoadRef, isOffline, type]); The last thing would be to handle the network change: when coming back online after being offline, reset the What alternative solutions did you explore? (Optional) |
Got it, thanks for the context @tranvantoan-qn! My biggest question is to understand how these |
@jliexpensify I have described the easiest way to reproduce the issue at the moment:
|
It looks like your proposal got posted as I was writing mine - it's great that we have a way to easily repro this one! If it's associated with Distance requests atm, we can fold this into #wave5 - https://expensify.slack.com/archives/C05DWUDHVK7/p1705872590528689 |
Proposal looks correct. I will do some testing on it and let you all know. |
Can someone please assign this to me since I reviewed the PR? Thanks! |
I assume we unassign @parasharrajat ? |
Deployed to prod: #36214 (comment) |
Checklist
|
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-02-26. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payment Summary:
|
$500 approved for @allroundexperts based on summary above. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.25-4
Reproducible in staging?: Yes
Reproducible in production?: It's worse on production, the app fails to load completely once I sign in.
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @lindboe
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1705427206739379?thread_ts=1705360862.915459&cid=C01GTK53T8Q
Action Performed:
Expected Result:
After the request returns a 404, the requests should stop being made.
Actual Result:
Requests for the image are infinitely repeated.
Workaround:
If this issue is encountered in production in its current state, the app can't be used at all, although I believe that particular issue may have been fixed by @cead22.
If this issue is encountered in staging, I don't think this prevents usage.
In development, it causes a connection/file descriptor leak as webpack generates more and more connections it never clears. This eventually leads to the developer's computer encountering errors and not working properly, including affecting internet access. (This must also be caused by a second issue with the app not clearing closed connections correctly).
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
In development:
receipt404.mov
Production screenshot:
Root cause and considerations for proposals:
Image
, which handles the load request, is memoized based on whether the identity of thesource
prop stays the sameImageWithSizeCalculation
is reconstructingsource
each render because it's creating the object in the prop. Pretty easy to fix with auseMemo
instead:This does NOT occur for the
Image/index.native.js
implementation.View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: