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

[android] Check for second callback in HttpRequestAndroid - #2905

Closed
ljbade wants to merge 0 commit into
masterfrom
2400-lock
Closed

ljbade wants to merge 0 commit into
masterfrom
2400-lock

Conversation

@ljbade

@ljbade ljbade commented Nov 3, 2015

Copy link
Copy Markdown
Contributor

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

ljbade commented Nov 3, 2015

Copy link
Copy Markdown
Contributor Author

@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

ljbade commented Nov 9, 2015

Copy link
Copy Markdown
Contributor Author

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

bleege commented Nov 9, 2015

Copy link
Copy Markdown
Contributor

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

ljbade commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

@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

tobrun commented Nov 10, 2015

Copy link
Copy Markdown
Member

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
Copy Markdown
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

ljbade commented Nov 12, 2015

Copy link
Copy Markdown
Contributor Author

Awesome @zugaldia.

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

@zugaldia

Copy link
Copy Markdown
Member

👍

@bleege

bleege commented Nov 12, 2015

Copy link
Copy Markdown
Contributor

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

ljbade commented Nov 12, 2015

Copy link
Copy Markdown
Contributor Author

@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

bleege commented Nov 13, 2015

Copy link
Copy Markdown
Contributor

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
Copy Markdown

+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

ljbade commented Nov 16, 2015

Copy link
Copy Markdown
Contributor Author

@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

ljbade commented Nov 16, 2015

Copy link
Copy Markdown
Contributor Author

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

ljbade commented Nov 16, 2015

Copy link
Copy Markdown
Contributor Author

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