Closed Bug 1541238 Opened 6 years ago Closed 6 years ago

Delays Tracking Loads

Categories

(Core :: Networking, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: xeonchen, Assigned: xeonchen)

References

()

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Create a preference that delays tracking loads:

network.delay.tracking.load = X microseconds; default is 0.

When this is set, loads associated with channels that load third party data (not the top level document) and are tagged as trackers will be delayed by X microseconds. “Delay” means that the request will not hit the network until the browser waits X microseconds.

Hi Honza, I have a feeling that this is a little bit similar to (or potentially partly included in) the tailing mechanism, but I'm not 100% sure. Could you give some comment before I start a new patch on this? Thanks.

Flags: needinfo?(honzab.moz)

Attach a link to the technical document "Telemetry and prefs related to proxying data."

What is the exact motivation and intention for creating something like that you propose?


Tailing adds a delay based on heuristic. Tailing mostly stands for a per whole request context (aka whole page) queue. Tailed requests are put at the tail of that queue. They are kept there (not even asyncOpen()'ed) until the networking churn calms. There is a longer delay before domcontentloaded and shorter after it.

Tailing only applies to those requests that we can move around like this:

  • async or dynamically added js scripts
  • images in the markup
  • xhr/fetch and I think element insertion from a tracking script (regardless the target domain, I think)

Delaying css and sync/defer scripts will badly impact performance as those block domcontentloaded.

Flags: needinfo?(honzab.moz)
Whiteboard: [necko-triaged]

(In reply to Honza Bambas (:mayhemer) from comment #3)

What is the exact motivation and intention for creating something like that you propose?

We're trying to run a study that fetches trackers through proxies.

I think this bug will help us to measure how much user-perspective performance will be impacted if some resources are transferred through a slower network path.

Tanvi, do you have more details about this?

Flags: needinfo?(tanvi)

Aha, so you only want to simulate slow network, OK. It then has nothing to do with tailing, it's way below it. Tailing prevents the whole channel from opening. What you want is to delay the response. There is throttling that devtools is using. Maybe you could reuse that code, if easy to do.

See https://searchfox.org/mozilla-central/source/netwerk/base/ThrottleQueue.h and its use in the net code and devtools

Flags: needinfo?(tanvi)

Comment on attachment 9056038 [details]
Bug 1541238 - add pref to delay 3rd-party tracker;

The delay has to be done before the request is made, so I think we can probably postpone |BeginConnectActual| for the given case?

Attachment #9056038 - Flags: feedback?(honzab.moz)
Attachment #9056038 - Flags: feedback?(honzab.moz) → feedback+
Pushed by xeonchen@gmail.com: https://hg.mozilla.org/integration/autoland/rev/557f1dbc18ca add pref to delay 3rd-party tracker; r=mayhemer
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68

This was only a feedback not a review. Did you meant to push it?

Flags: needinfo?(xeonchen)

(In reply to Dragana Damjanovic [:dragana] from comment #10)

This was only a feedback not a review. Did you meant to push it?

sorry, bugzilla did not show me the phabricator before, I do not know why.

Flags: needinfo?(xeonchen)

Comment on attachment 9056038 [details]
Bug 1541238 - add pref to delay 3rd-party tracker;

Beta/Release Uplift Approval Request

  • Feature/Bug causing the regression: N/A
  • User impact if declined: No impact, this is used for experiment.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This is default disabled feature.
  • String changes made/needed: N/A
Attachment #9056038 - Flags: approval-mozilla-beta?

Comment on attachment 9056038 [details]
Bug 1541238 - add pref to delay 3rd-party tracker;

Uplift approved for 67 beta 11, thanks

Attachment #9056038 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Backed out 4 changesets (Bug 1541238, Bug 1542069, Bug 1533363) for build bustages - missing Bug 1536488

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-beta&revision=74c650902989c6b30b913c4b20639bf71ba11aef&selectedJob=240336243

Backout link: https://hg.mozilla.org/releases/mozilla-beta/rev/ca196717df0793c823865553b8907cf28573597f

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=240336243&repo=mozilla-beta&lineNumber=13796

[task 2019-04-15T12:55:45.628Z] 12:55:45 INFO - make[5]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/js/xpconnect/tests/components/native'
[task 2019-04-15T12:55:46.569Z] 12:55:46 INFO - make[5]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/netwerk/protocol/http'
[task 2019-04-15T12:55:46.577Z] 12:55:46 INFO - /builds/worker/workspace/build/src/clang/bin/clang++ -o Unified_cpp_protocol_http2.i_o -c -I/builds/worker/workspace/build/src/obj-firefox/dist/stl_wrappers -I/builds/worker/workspace/build/src/obj-firefox/dist/system_wrappers -include /builds/worker/workspace/build/src/config/gcc_hidden.h -DNDEBUG=1 -DTRIMMED=1 -DOS_POSIX=1 -DOS_LINUX=1 -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/builds/worker/workspace/build/src/netwerk/protocol/http -I/builds/worker/workspace/build/src/obj-firefox/netwerk/protocol/http -I/builds/worker/workspace/build/src/obj-firefox/ipc/ipdl/_ipdlheaders -I/builds/worker/workspace/build/src/ipc/chromium/src -I/builds/worker/workspace/build/src/ipc/glue -I/builds/worker/workspace/build/src/dom/base -I/builds/worker/workspace/build/src/extensions/auth -I/builds/worker/workspace/build/src/netwerk/base -I/builds/worker/workspace/build/src/netwerk/cookie -I/builds/worker/workspace/build/src/netwerk/url-classifier -I/builds/worker/workspace/build/src/obj-firefox/dist/include -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nspr -I/builds/worker/workspace/build/src/obj-firefox/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/build/src/obj-firefox/mozilla-config.h -Qunused-arguments -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++1z-compat -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -Wno-return-type-c-linkage -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fcrash-diagnostics-dir=/builds/worker/artifacts -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -Xclang -load -Xclang /builds/worker/workspace/build/src/obj-firefox/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O3 -fomit-frame-pointer -funwind-tables -Werror -fprofile-instr-generate -MD -MP -MF .deps/Unified_cpp_protocol_http2.i_o.pp /builds/worker/workspace/build/src/obj-firefox/netwerk/protocol/http/Unified_cpp_protocol_http2.cpp
[task 2019-04-15T12:55:46.578Z] 12:55:46 INFO - In file included from /builds/worker/workspace/build/src/obj-firefox/netwerk/protocol/http/Unified_cpp_protocol_http2.cpp:29:
[task 2019-04-15T12:55:46.580Z] 12:55:46 ERROR - /builds/worker/workspace/build/src/netwerk/protocol/http/nsHttpChannel.cpp:1303:28: error: no member named 'CLASSIFIED_ANY_BASIC_TRACKING' in 'nsIHttpChannel::ClassificationFlags'; did you mean 'CLASSIFIED_ANY_TRACKING'?
[task 2019-04-15T12:55:46.581Z] 12:55:46 INFO - } else if (flags & CF::CLASSIFIED_ANY_BASIC_TRACKING) {
[task 2019-04-15T12:55:46.582Z] 12:55:46 INFO - ^
[task 2019-04-15T12:55:46.582Z] 12:55:46 INFO - CLASSIFIED_ANY_TRACKING
[task 2019-04-15T12:55:46.583Z] 12:55:46 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/nsIHttpChannel.h:200:5: note: 'CLASSIFIED_ANY_TRACKING' declared here
[task 2019-04-15T12:55:46.584Z] 12:55:46 INFO - CLASSIFIED_ANY_TRACKING = 125,
[task 2019-04-15T12:55:46.585Z] 12:55:46 INFO - ^
[task 2019-04-15T12:55:46.586Z] 12:55:46 INFO - 1 error generated.
[task 2019-04-15T12:55:46.587Z] 12:55:46 INFO - /builds/worker/workspace/build/src/config/rules.mk:805: recipe for target 'Unified_cpp_protocol_http2.i_o' failed
[task 2019-04-15T12:55:46.588Z] 12:55:46 ERROR - make[5]: *** [Unified_cpp_protocol_http2.i_o] Error 1
[task 2019-04-15T12:55:46.589Z] 12:55:46 INFO - make[5]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/netwerk/protocol/http'
[task 2019-04-15T12:55:46.591Z] 12:55:46 INFO - make[5]: *** Waiting for unfinished jobs....
[task 2019-04-15T12:55:46.592Z] 12:55:46 INFO - make[5]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/js/xpconnect/src'

Flags: needinfo?(xeonchen)
Flags: needinfo?(pascalc)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1536488
No longer depends on: 1536488

The uplift plan has been canceled.

Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Flags: needinfo?(xeonchen)
Resolution: --- → FIXED
Flags: needinfo?(pascalc)
Flags: qe-verify-
Attachment #9056038 - Flags: approval-mozilla-beta+ → approval-mozilla-beta-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: