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
The crash x + width must be <= bitmap.width() means that the width and originXhere has sum larger than the image original width, so it's unable to crop. Since when calculating originXhere, we use a lot of division and multiply operation, the originX could end up being slightly larger than its maximum possible value, due to JS rounding mechanism, leading to originX + width is larger than image original width and the crash occurs.
What changes do you think we should make in order to solve the problem?
In here, we should use Math.min to limit originX value to originalImageWidth.value - size, so originX + width cannot be larger than the originalImageWidth.value.
We should also do similarly for originY
What alternative solutions did you explore? (Optional)
@ShridharGoel firebase crashes often don't lead all the way to the source in E/App, probably because the JS code is minified when we build & deploy it. I'm not exactly sure if there's something we can do to make that work, if you can figure it out I'm sure we'd love to have that :D
@tienifr How did you come up with the error source?
@parasharrajat I found it by looking at the error logs, it's related to the expo.modules.imagemanipulator, while the user is cropping the image (CropAction)
Were you able to reproduce this successfully?
Not by user action, but if I manually modify the values (originX, width) to a slightly larger number then it will crash similarly, I think it will be quite hard to reproduce by user action since this relates to JS rounding mechanism, it might happen at a specific image size and zooming level. My solution will help mitigate that.
@Beamanator may be you can use the info provided by @tienifr and logging console to reproduce issue. There might be something useful to determine the image used which caused this like device id etc.
Unless we are able to reproduce this, I don't think we should try to change the code.
I would prefer if we only write up a fix if we are able to reproduce, but I can also see how @tienifr 's changes would "fix" the issue - I would propose we keep this open for a bit, with Needs Reproduction to see if anyone can find out how to consistently reproduce the issue. If we can't / if this doesn't happen again, we can decide to close or implement the "fix"
This issue has not been updated in over 15 days. @Beamanator, @parasharrajat eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
Activity
melvin-bot commentedon May 13, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)ShridharGoel commentedon May 13, 2024
@Beamanator Can you share the full stacktrace?
Beamanator commentedon May 13, 2024
Sure thing @ShridharGoel ! here's the full stack trace:
ShridharGoel commentedon May 13, 2024
@Beamanator Any idea why it isn't showing the source of the crash in E/App? Like the method name/line numbers.
tienifr commentedon May 13, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Crash: java.lang.IllegalArgumentException - expo.modules.imagemanipulator.actions.CropAction.run
What is the root cause of that problem?
The crash
x + width must be <= bitmap.width()means that thewidthandoriginXhere has sum larger than the image original width, so it's unable to crop. Since when calculatingoriginXhere, we use a lot of division and multiply operation, theoriginXcould end up being slightly larger than its maximum possible value, due to JS rounding mechanism, leading tooriginX + widthis larger than image original width and the crash occurs.What changes do you think we should make in order to solve the problem?
In here, we should use
Math.minto limitoriginXvalue tooriginalImageWidth.value - size, sooriginX + widthcannot be larger than theoriginalImageWidth.value.We should also do similarly for
originYWhat alternative solutions did you explore? (Optional)
NA
parasharrajat commentedon May 13, 2024
@tienifr How did you come up with the error source? Were you able to reproduce this successfully?
Beamanator commentedon May 14, 2024
@ShridharGoel firebase crashes often don't lead all the way to the source in E/App, probably because the JS code is minified when we build & deploy it. I'm not exactly sure if there's something we can do to make that work, if you can figure it out I'm sure we'd love to have that :D
tienifr commentedon May 14, 2024
@parasharrajat I found it by looking at the error logs, it's related to the
expo.modules.imagemanipulator, while the user is cropping the image (CropAction)Not by user action, but if I manually modify the values (
originX,width) to a slightly larger number then it will crash similarly, I think it will be quite hard to reproduce by user action since this relates to JS rounding mechanism, it might happen at a specific image size and zooming level. My solution will help mitigate that.parasharrajat commentedon May 14, 2024
@Beamanator may be you can use the info provided by @tienifr and logging console to reproduce issue. There might be something useful to determine the image used which caused this like device id etc.
Unless we are able to reproduce this, I don't think we should try to change the code.
Beamanator commentedon May 15, 2024
I would prefer if we only write up a fix if we are able to reproduce, but I can also see how @tienifr 's changes would "fix" the issue - I would propose we keep this open for a bit, with
Needs Reproductionto see if anyone can find out how to consistently reproduce the issue. If we can't / if this doesn't happen again, we can decide to close or implement the "fix"9 remaining items
Beamanator commentedon May 27, 2024
Looks like this crash happened a few more times this week on
v1.4.74-6, with this stack trace given:Beamanator commentedon May 27, 2024
So I think we should keep this open to try to get some help reproducing
parasharrajat commentedon May 27, 2024
@Beamanator Is there a way from logs to map it to a particular action? If we can find out what API was called and what the action was, it will help.
I guess that internal team would have more info to reproduce this.
parasharrajat commentedon May 29, 2024
No updates.
Beamanator commentedon May 29, 2024
I don't know of any way to do this, sadly... I say lets drop this to weekly while we wait, and we'll see if this crash keeps happening
melvin-bot commentedon Jun 21, 2024
This issue has not been updated in over 15 days. @Beamanator, @parasharrajat eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
parasharrajat commentedon Jun 22, 2024
@Beamanator Any updates?
Beamanator commentedon Jun 24, 2024
Looks like this hasn't occurred since a bit after June 3, so let's close it out!