Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 6 users
Status: Fixed
Owner:
Email to this user bounced
Closed: Mar 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment
sendBeacon request max allowed size
Reported by vex...@gmail.com, Mar 15 2017 Back to list
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
Open DevTools

Make 3 requests
navigator.sendBeacon('/server.php', new Array(Math.round(65536 / 2)).join('X'));
navigator.sendBeacon('/server.php', new Array(Math.round(65536 / 2)).join('X'));
navigator.sendBeacon('/server.php', new Array(Math.round(65536 / 2)).join('X'));

3 request will be rejected because sendBeacon return false. Any other requests with sendBeacon will be rejected too.

Other situation. (Reload page)

Make 3 requests
navigator.sendBeacon('/server.php', new Array(Math.round(65536 / 2)).join('X'));
navigator.sendBeacon('/server.php', new Array(Math.round(65536 / 2)).join('X'));
navigator.sendBeacon('/server.php', new Array(Math.round(3)).join('X'));

After that i can make requests with any body size. For example:

navigator.sendBeacon('/server.php', new Array(Math.round(65536 *5)).join('X'))

It will work.

What is the expected behavior?
All requests should be executed

What went wrong?
Can not send any sendBeacon requests until buffer get 64kb of data.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 56.0.2924.87  Channel: n/a
OS Version: OS X 10.12.3
Flash Version: 

Also you can see example here https://vexell.ru/files/testpool/

Click on link with example 7. See result.
Reload page
Click on link with example 8. See result.

Firefox works well and it does not have body size limit.
Chrome Canary (59.0.3042.0) has same problem.
 
Comment 1 by sigbjo...@opera.com, Mar 15 2017
Owner: sigbjo...@opera.com
Status: Started
Comment 2 by sigbjo...@opera.com, Mar 15 2017
Components: Blink>Network
Comment 3 by nazi...@gmail.com, Mar 15 2017
I have the same situation.

<script>
var url = 'log';

var x_32    = new Array(32768).join('x');
var x_small = new Array(3).join('x');
var x_large = new Array(65536 *5).join('x');


function send32Pack() {
    console.log(navigator.sendBeacon(url, x_32));
    console.log(navigator.sendBeacon(url, x_32));
    console.log(navigator.sendBeacon(url, x_32));
}

function sendPackWithSmall() {
    console.log(navigator.sendBeacon(url, x_32));
    console.log(navigator.sendBeacon(url, x_small));
    console.log(navigator.sendBeacon(url, x_large));
}

function main() {
    send32Pack(); // true // true // false
    send32Pack(); // false // false // false
    send32Pack(); // false // false // false
    
    // ... 
    sendPackWithSmall(); // false // true (Why?) // true (Why?)

    // All next sendBeacon return true
    sendPackWithSmall(); // true // true // true
    send32Pack(); // true // true // true
    sendPackWithSmall(); // true // true // true
}

// Test sendBeacon
main();
</script>
index.html
978 bytes View Download
Comment 4 by nazi...@gmail.com, Mar 15 2017
OS: Ubuntu 16.04.1 LTS
Chrome: Version 56.0.2924.87 unknown (64-bit)
Project Member Comment 5 by bugdroid1@chromium.org, Mar 15 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c1a211aa583ade023aca652e9493c01603623aa3

commit c1a211aa583ade023aca652e9493c01603623aa3
Author: sigbjornf <sigbjornf@opera.com>
Date: Wed Mar 15 15:30:36 2017

sendBeacon(): once transmission allowance has been reached, always fail.

Fix allowance checking logic for Beacon transmissions upon reaching
the limit. If the allowance limit was 'perfectly' exhausted after N
Beacon requests, subsequent Beacon requests would go ahead without
the (now zero) allowance limit imposed.

R=mkwst
BUG= 701678 

Review-Url: https://codereview.chromium.org/2751953002
Cr-Commit-Position: refs/heads/master@{#457088}

[add] https://crrev.com/c1a211aa583ade023aca652e9493c01603623aa3/third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-limit.html
[modify] https://crrev.com/c1a211aa583ade023aca652e9493c01603623aa3/third_party/WebKit/Source/core/loader/PingLoader.cpp

Project Member Comment 6 by bugdroid1@chromium.org, Mar 24 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/095bbad98260feae3a161c19ca1e9d9809dd544b

commit 095bbad98260feae3a161c19ca1e9d9809dd544b
Author: sigbjornf <sigbjornf@opera.com>
Date: Fri Mar 24 21:46:58 2017

Clarify Beacon transmission limit checking.

The implementation of navigator.sendBeacon() imposes a cap on the size
of transmitted beacon payloads. The internal handling of that limit
was not as clear as could be, so attempt to clarify its representation
and handling.

Also clarify the interpretation of a negative cap limit: if a frame's
settings provide a negative value, no transmission limit is imposed.

R=mkwst, tyoshino
BUG= 701678 

Review-Url: https://codereview.chromium.org/2753863003
Cr-Commit-Position: refs/heads/master@{#459564}

[add] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-allowance-no-limit.html
[modify] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/Source/core/frame/Settings.json5
[modify] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/Source/core/loader/PingLoader.cpp
[modify] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/Source/core/loader/PingLoader.h
[modify] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp
[modify] https://crrev.com/095bbad98260feae3a161c19ca1e9d9809dd544b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h

Comment 7 by sigbjo...@opera.com, Mar 25 2017
Status: Fixed
Sign in to add a comment