Closed Bug 1545039 Opened 5 years ago Closed 5 years ago

GeckoWebExecutor sometimes sends empty request bodies

Categories

(GeckoView :: General, defect, P1)

All
Android
defect

Tracking

(firefox66 wontfix, firefox67 wontfix, firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: sebastian, Assigned: snorp)

Details

(Whiteboard: [geckoview:fenix:m4])

Attachments

(1 file)

AC issue: https://github.com/mozilla-mobile/android-components/issues/2715

See comments in AC issue.

Some quotes:

Working with @vladikoff and @thomcc, we can now reproduce this consistently. We have some POST requests getting sent without a body although the InputStream was correctly passed from A-S to A-C, then read into a ByteBuffer and passed to GWE.

GWE also sets the content-length header correctly based on the size of the ByteBuffer, but then fails to read, and sends an empty request body. After debugging this for a while, one suspicion is the potential offset of the backing array in ByteBuffer. In the non-working case, we always see an offset, meaning that just consuming e.g. from buffer.array() (without taking the offset into account) wouldn't work as the first byte(s) will be 0.

Since GWE requires a direct ByteBuffer (created with ByteBuffer.allocateDirect), A-C doesn't seem to be able to control this offset and it would have to be taken into account on the consuming-side (in GWE)...unless GWE is just using JNI's GetDirectBufferAddress which should just work.

Copying question from the AC issue here and setting needinfo for snorp :)

@snorp We need your help here :). Did you encounter this before (failing for some but not all streams)? Anything we're doing wrong there when creating the ByteBuffer: https://github.com/mozilla-mobile/android-components/blob/master/components/browser/engine-gecko-nightly/src/main/java/mozilla/components/browser/engine/gecko/fetch/GeckoViewFetchClient.kt#L97

Flags: needinfo?(snorp)

I replied on github, but I do think we have some sort of bug here. I'll investigate today.

Flags: needinfo?(snorp)
Assignee: nobody → snorp

James says this bug is blocking Fenix Sync.

Priority: -- → P1
Whiteboard: [geckoview:fenix:m4]
Pushed by jwillcox@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/729b68c38f9f
Correctly copy request bodies in GeckoWebExecutor r=geckoview-reviewers,agi
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: