Closed Bug 1529022 Opened 5 years ago Closed 5 years ago

Add a GeckoChildProcessHosts iterator

Categories

(Toolkit :: Performance Monitoring, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: tarek, Assigned: tarek)

References

Details

Attachments

(1 file)

Follow-up bug to add VR and GMP processes

Summary: add the VR and GPM process to GetProcInfo → add the VR and GMP process to GetProcInfo

A better, future-proof option would be to have a process iterator that would allow us to get a list, instead of adding them ma ually at https://searchfox.org/mozilla-central/source/dom/base/ChromeUtils.cpp#724-747

Maybe Jed has some ideas about how we could do this? Nathan suggested GeckoChildProcessHost

Flags: needinfo?(jld)

I don't see why we couldn't have a list of all GeckoChildProcessHosts, and that class has mChildProcessHandle for calling OS APIs on the child. (IPC's ProcessHandle is the same as a pid on Unix, but different on Windows.) You'll need to be careful with locking, because a lot of things happen on different threads here. Also we probably aren't handling process exit as carefully as we could be, so beware of possibly trying to query dead processes (and theoretically you can end up querying an unrelated process if the pid was reused by then, but usually that takes long enough that it's unlikely to be a problem in practice).

Flags: needinfo?(jld)
Priority: -- → P3
Summary: add the VR and GMP process to GetProcInfo → Add a GeckoChildProcessHosts iterator

Adds GeckoChildProcessHost::GetAll() and use it in ChromeUtils::GetProcInfo()

Jed, this is a first shot at the feature, I used a mutex protected LinkedList and I think I found the right spot for removing processes from the list.

It seems to work fine from my manual tests at adding/removing a bunch of tabs and calling GetProcInfo()

One thing I don't like about this patch is the fact that we will need to sync ProcType and GeckoProcessType. Is there a trick to avoid duplication there?

Thanks!

Flags: needinfo?(jld)
Pushed by tziade@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/11c118fa5f2b
Add a GeckoChildProcessHosts iterator r=jld
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Backout by rgurzau@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/82a145adddad
Backed out changeset 11c118fa5f2b for build bustages at GeckoChildProcessHost.cpp a=backout

Backed out changeset 11c118fa5f2b (bug 1529022) for build bustages at GeckoChildProcessHost.cpp a=backout

Backout link: https://hg.mozilla.org/mozilla-central/rev/82a145adddad6ef0a8434fd25e049c60a3b87276

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=mozilla-central&selectedJob=252407034&resultStatus=testfailed%2Cbusted%2Cexception&revision=5f0f3775605323d865539da3a7c4cb3d1fd36ff2

Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=252407034&repo=mozilla-central&lineNumber=13968

Log snippet:

[task 2019-06-19T04:19:20.597Z] 04:19:20 INFO - mkdir -p '.deps/'
[task 2019-06-19T04:19:20.597Z] 04:19:20 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/storage/test/gtest'
[task 2019-06-19T04:19:20.597Z] 04:19:20 INFO - make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/storage/test/gtest'
[task 2019-06-19T04:19:20.597Z] 04:19:20 INFO - storage/test/gtest/Unified_cpp_storage_test_gtest0.o
[task 2019-06-19T04:19:20.597Z] 04:19:20 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/storage/test/gtest'
[task 2019-06-19T04:19:22.349Z] 04:19:22 INFO - make[4]: Entering directory '/builds/worker/workspace/build/src/obj-firefox/ipc/glue'
[task 2019-06-19T04:19:22.352Z] 04:19:22 INFO - /builds/worker/workspace/build/src/clang/bin/clang++ -isysroot /builds/worker/workspace/build/src/MacOSX10.11.sdk --target=x86_64-apple-darwin -o GeckoChildProcessHost.o -c -fvisibility=hidden -fvisibility-inlines-hidden -DDEBUG=1 -DHAVE_UINT64_T -DWEBRTC_POSIX -DWEBRTC_BUILD_LIBEVENT -DWEBRTC_MAC -DOS_POSIX=1 -DOS_MACOSX=1 '-DMOZ_CHILD_PROCESS_NAME="plugin-container"' '-DMOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"' -DSTATIC_EXPORTABLE_JS_API -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/builds/worker/workspace/build/src/ipc/glue -I/builds/worker/workspace/build/src/obj-firefox/ipc/glue -I/builds/worker/workspace/build/src/caps -I/builds/worker/workspace/build/src/dom/broadcastchannel -I/builds/worker/workspace/build/src/dom/indexedDB -I/builds/worker/workspace/build/src/dom/storage -I/builds/worker/workspace/build/src/media/webrtc/trunk -I/builds/worker/workspace/build/src/media/webrtc/trunk/webrtc -I/builds/worker/workspace/build/src/xpcom/build -I/builds/worker/workspace/build/src/dom/ipc -I/builds/worker/workspace/build/src/toolkit/crashreporter -I/builds/worker/workspace/build/src/toolkit/xre -I/builds/worker/workspace/build/src/xpcom/base -I/builds/worker/workspace/build/src/xpcom/threads -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/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 -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=backend-plugin -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 -fno-sized-deallocation -fcrash-diagnostics-dir=/builds/worker/artifacts -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-exceptions -fno-strict-aliasing -stdlib=libc++ -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 -fno-omit-frame-pointer -funwind-tables -Wno-error=shadow -Wno-shadow @/builds/worker/workspace/build/src/obj-firefox/code_coverage_cflags -MD -MP -MF .deps/GeckoChildProcessHost.o.pp /builds/worker/workspace/build/src/ipc/glue/GeckoChildProcessHost.cpp
[task 2019-06-19T04:19:22.355Z] 04:19:22 ERROR - /builds/worker/workspace/build/src/ipc/glue/GeckoChildProcessHost.cpp:106:1: error: no template named 'StaticAutoPtr'; did you mean 'mozilla::StaticAutoPtr'?
[task 2019-06-19T04:19:22.356Z] 04:19:22 INFO - StaticAutoPtr<mozilla::LinkedList<GeckoChildProcessHost>>
[task 2019-06-19T04:19:22.357Z] 04:19:22 INFO - ^~~~~~~~~~~~~
[task 2019-06-19T04:19:22.358Z] 04:19:22 INFO - mozilla::StaticAutoPtr
[task 2019-06-19T04:19:22.359Z] 04:19:22 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/StaticPtr.h:39:50: note: 'mozilla::StaticAutoPtr' declared here
[task 2019-06-19T04:19:22.360Z] 04:19:22 INFO - class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticAutoPtr {
[task 2019-06-19T04:19:22.361Z] 04:19:22 INFO - ^
[task 2019-06-19T04:19:22.362Z] 04:19:22 ERROR - /builds/worker/workspace/build/src/ipc/glue/GeckoChildProcessHost.cpp:109:1: error: unknown type name 'StaticMutex'; did you mean 'mozilla::StaticMutex'?
[task 2019-06-19T04:19:22.362Z] 04:19:22 INFO - StaticMutex GeckoChildProcessHost::sMutex;
[task 2019-06-19T04:19:22.363Z] 04:19:22 INFO - ^~~~~~~~~~~
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - mozilla::StaticMutex
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/StaticMutex.h:79:59: note: 'mozilla::StaticMutex' declared here
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - typedef BaseStaticMutex<recordreplay::Behavior::Preserve> StaticMutex;
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - ^
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - 2 errors generated.
[task 2019-06-19T04:19:22.364Z] 04:19:22 INFO - /builds/worker/workspace/build/src/config/rules.mk:810: recipe for target 'GeckoChildProcessHost.o' failed
[task 2019-06-19T04:19:22.364Z] 04:19:22 ERROR - make[4]: *** [GeckoChildProcessHost.o] Error 1

Status: RESOLVED → REOPENED
Flags: needinfo?(tarek)
Resolution: FIXED → ---
Target Milestone: mozilla69 → ---
Flags: needinfo?(tarek)
Flags: needinfo?(jld)
Pushed by tziade@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f79736d79ee1
Add a GeckoChildProcessHosts iterator r=jld
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

I don't understand what happened, phab pushed the old patch, not the new one with the fix,. Will try agaon.

Flags: needinfo?(tarek)
Pushed by tziade@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/182966bfca87
Add a GeckoChildProcessHosts iterator r=jld
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Regressions: 1560670
No longer regressions: 1560670
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: