Skip to content
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

EXC_BAD_ACCESS memory issue in Router #4590

Open
faliinitse opened this issue Jan 24, 2024 · 10 comments
Open

EXC_BAD_ACCESS memory issue in Router #4590

faliinitse opened this issue Jan 24, 2024 · 10 comments

Comments

@faliinitse
Copy link

Mapbox is giving an EXC_BAD_ACCESS error in the Router Class. This issue is strange and difficult to debug. Let me explain a little about our app. We have an app with blocks, each containing many trips. The app is working fine for all the blocks and their trips. However, for just one block and its trip, the app is crashing when rerouting occurs. We don't know why it's crashing only for that particular trip of a block, and only in the case of rerouting. I am attaching a screenshot; perhaps you can guide us on how to track this bug. I even checked the route data by converting it into plain json string; there is not much change when it first loads and when the reroute occurs. Even all the properties routeData,routeRequest and responseOrigin have data but as soon as it reach the line 75 it gives this error. So, I am confused about what the exact issue is. Just for your information, we are loading a custom route and not using Mapbox Direction API for loading routes. Routes are coming from our own server.

Screenshot 2024-01-19 at 16 16 06
@baleboy
Copy link

baleboy commented Jan 24, 2024

Could you share a full log that includes the error?

@OdNairy OdNairy transferred this issue from mapbox/mapbox-maps-ios Jan 24, 2024
@faliinitse
Copy link
Author

Could you share a full log that includes the error?

Here is the log file of crash

logFile.txt

@faliinitse
Copy link
Author

Hi, @baleboy , do you need anything else regarding this issue to be solved? We are stuck for our next release, and this issue is a major roadblock for us. Could you please help me in this case?

@kried
Copy link
Contributor

kried commented Feb 12, 2024

Hi @faliinitse
Could you please share the Navigation and Directions SDK versions you are using?
Is the problem reproducing consistently during the reroute?

Would it be possible to share the route response that cause the crash?

@faliinitse
Copy link
Author

faliinitse commented Feb 13, 2024

Hi @kried

Following is the screenshot of my podfile.lock

Screenshot 2024-02-13 at 09 14 13

Here is the routeResponse output as p routeResponse and po routeResponse for the initial load when no crash has occurred, and after rerouting when the actual crash is occurring.

First load when no crash occurred
poResponseFirstLoad.txt
pResponseFirstLoad.txt

After rerouting when crash occurred.

poResponseAfterRerouting.txt
PResponseAfterRerouting.txt

I also converted the routeData to plain JSON string; it may also help in identifying the crash.

routeDataJsonAfterRerouting.txt
routeDataJsonFirstLoad.txt

@faliinitse
Copy link
Author

Is the problem reproducing consistently during the reroute?

Yes, it always crashes when rerouting occurs for one of our trips. For all other trips, it works fine. However, it only crashes during rerouting for this particular trip. I've shared the JSON data and routeResponse. I hope it will help to find the bug.

@faliinitse
Copy link
Author

Hi @kried,

Any update on this issue? Our new release is stalled because of this problem. Could you please provide an update if you've found anything based on the data I provided? I would highly appreciate it if you could respond to my comment.

@kried
Copy link
Contributor

kried commented Apr 3, 2024

Hi @faliinitse

Thank you for the recorded data, we were able to reproduce the problem. We will fix the crash in upcoming SDK releases.

But the response routeDataJsonAfterRerouting.txt seems to be incorrect. It contains the 11 waypoints, but only 9 legs instead of 10. The SDK definitely should not crash in such cases, but the waypoints list should be decreased in the response.
After looking at the legs in the response, it seems like the last waypoint is redundant.

So the response.json with the removed last waypoint does not cause the crash.

Could you please answer if you received this response from Directions API or did you use the custom routing provider? Or did you manually change some properties in the response?

@faliinitse
Copy link
Author

Hi @kried,

Thank you for working on this issue and fixing it. Could you please inform us when you implement this fix in the next version so that I can retest it?

Regarding your second point, we have our own endpoint from which we retrieve data, and we do not use the DirectionAPI. I will communicate this to our backend developer so that they can address the issue accordingly and we also fix this.

One last point to consider is this that this issue also affects the Android side. Should we open a new ticket for Android, or will the fix apply to both platforms in a future version?

@kried
Copy link
Contributor

kried commented Apr 4, 2024

@faliinitse
This exact crash won't happen on Android, but please validate the response to the Directions API response scheme to avoid incorrect response parsing.

E.g. the response does not contain the required field name for the Waypoint object in the response and there is no code at the top level of the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants