Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Check for second callback in HttpRequestAndroid #2905

Closed
wants to merge 0 commits into from

Conversation

ljbade
Copy link
Contributor

@ljbade ljbade commented Nov 3, 2015

Fixes #2400

@ljbade ljbade added Android Mapbox Maps SDK for Android ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold in progress labels Nov 3, 2015
@ljbade
Copy link
Contributor Author

ljbade commented Nov 3, 2015

@zugaldia @bleege @tobrun This PR seems to fix the crash. But I still not sure why the callback gets called twice. It shouldn't.

I need to dig into this more to see if I can find the actual problem here.

@ljbade ljbade force-pushed the 2400-lock branch 2 times, most recently from 4104257 to b9e9237 Compare November 9, 2015 22:26
@ljbade ljbade removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Nov 9, 2015
@ljbade
Copy link
Contributor Author

ljbade commented Nov 9, 2015

I have squashed and tidied up the commit.

@bleege @zugaldia One last review/test will be appreciated.

Final step is to wait for CI then merge when all happy.

@bleege
Copy link
Contributor

bleege commented Nov 9, 2015

I have squashed and tidied up the commit.

Does this mean that you've found out why the callback gets called twice? If so can you explain what's going on? Thanks!

@ljbade
Copy link
Contributor Author

ljbade commented Nov 10, 2015

@bleege I think @zugaldia's changes prevented the double callback, though I should go and double check this again with logging.

I suspect it had something to with how we handle IOExceptions in onResponse. Particularly the change from just returning on an exception, to rethrowing it.

@tobrun
Copy link
Member

tobrun commented Nov 10, 2015

When reproducing the crash I mentioned earlier I'm differentiating 2 outcomes:

Scenario 1

the application doesn't crash, related stacktrace below

screen shot 2015-11-10 at 12 59 05

Scenario 2

the application doesn't crash but halts for a moment before continuing. (skipped frames)

screen shot 2015-11-10 at 12 59 25

@zugaldia
Copy link
Member

To help debugging requests I just added an application interceptor (it's disabled by default): 561a36c

This interceptor does not change the request or response in any way, it simply logs the outgoing request and the incoming response data. To see it in action, you need to enable it in the HTTPContext constructor.

@ljbade
Copy link
Contributor Author

ljbade commented Nov 12, 2015

Awesome @zugaldia.

I will also rebase this branch to bring in API 15 fixes for next SNAPSHOT

@zugaldia
Copy link
Member

👍

@bleege
Copy link
Contributor

bleege commented Nov 12, 2015

I will also rebase this branch to bring in API 15 fixes for next SNAPSHOT

Just checking, but if we're done with this why not just merge into master? Remember, the only reason that the last SNAPSHOT was based off this branch is because we wanted to isolate and test the OkHttp work.

@ljbade
Copy link
Contributor Author

ljbade commented Nov 12, 2015

@bleege oh true... quick question, should we run a perf benchmark somehow before we merge just to test out concerns around JNI overhead (#2400 (comment))

@bleege
Copy link
Contributor

bleege commented Nov 13, 2015

should we run a perf benchmark somehow before we merge just to test out concerns around JNI overhead

Sounds like a great idea. Please make it happen.

@manimaul
Copy link

+1 for Merging this into master. Having the networking in the Java layer could allow for implementing tile data providers in the Java layer with minimal effort. (E.g. https://github.com/manimaul/mapbox-gl-native/tree/offline)

@ljbade
Copy link
Contributor Author

ljbade commented Nov 16, 2015

@tobrun @zugaldia Do you have some ideas on how we can benchmark the HTTP library?

There isn't an easy to request a bunch of tiles to load directly without modifying the C++ lib. Otherwise we could try panning to a set of locations after clearing the cache. We would need to add some logging or stat tracking code in the C++ layer to measure the difference however.

@ljbade
Copy link
Contributor Author

ljbade commented Nov 16, 2015

I think I am going to merge this branch now. We can then go back and benchmark before and after once we figure out how best to do this.

@ljbade ljbade closed this Nov 16, 2015
@ljbade ljbade deleted the 2400-lock branch November 16, 2015 23:14
@ljbade
Copy link
Contributor Author

ljbade commented Nov 16, 2015

Ah damn the PR was marked as closed not merged!

It was merged in af2d034

@bleege bleege added this to the android-v2.3.0 milestone Nov 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants