New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 753490 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Fuchsia
Pri: 3
Type: Bug

Blocking:
issue 706592



Sign in to add a comment

See if Fuchsia wants to support an exit code on zx_task_kill()

Project Member Reported by scottmg@chromium.org, Aug 8 2017

Issue description

Some base_unittests want to kill a process and then check that it exited with right thing, but mx_task_kill() doesn't support this.

Confirm with Magenta team if they plan to support this. For now disable these tests.
 
Components: Internals>PlatformIntegration
Labels: -OS-Linux OS-Fuchsia
Owner: scottmg@chromium.org
Status: Assigned (was: Unconfirmed)
One place where this is used is https://cs.chromium.org/chromium/src/base/process/kill_fuchsia.cc?rcl=8a8857bf3b85740531e81f105b491d12fa7e7c9d&l=23 . Perhaps we could signal that some other way.
Cc: cpu@chromium.org kulakowski@chromium.org
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fcea246e3283d79c160bc71d707610afac10eef2

commit fcea246e3283d79c160bc71d707610afac10eef2
Author: Scott Graham <scottmg@chromium.org>
Date: Wed Aug 09 21:53:53 2017

fuchsia: Shuffle filter file for task_kill-related failures

Bug: 706592, 753490
Change-Id: I0468e996471029d271225886c00493d92c8f30fc
Reviewed-on: https://chromium-review.googlesource.com/607394
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493155}
[modify] https://crrev.com/fcea246e3283d79c160bc71d707610afac10eef2/base/process/process_fuchsia.cc
[modify] https://crrev.com/fcea246e3283d79c160bc71d707610afac10eef2/testing/buildbot/filters/fuchsia.base_unittests.filter

Project Member

Comment 5 by bugdroid1@chromium.org, Aug 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ec32f1828e254a45836f30fca990e58bcc0fd077

commit ec32f1828e254a45836f30fca990e58bcc0fd077
Author: Wez <wez@chromium.org>
Date: Thu Aug 17 02:58:25 2017

Fix base::Process::Current().Pid() and .Terminate().

Pid() and Terminate() became broken on base::Process instances returned
by base::Process::Current() when the calling-process was special-cased,
since those calls continued to rely upon the |process_| handle, which
was then null, rather than calling mx_process_self().

Also fix GetTerminationStatus() to correctly zero-out |exit_code|, and
to avoid touching it when it is null.

Bug: 706592, 753490
Change-Id: I8b5c211b81e5156784e92eff09578201f0b134c0
Reviewed-on: https://chromium-review.googlesource.com/618180
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495060}
[modify] https://crrev.com/ec32f1828e254a45836f30fca990e58bcc0fd077/base/process/kill_fuchsia.cc
[modify] https://crrev.com/ec32f1828e254a45836f30fca990e58bcc0fd077/base/process/process_fuchsia.cc
[modify] https://crrev.com/ec32f1828e254a45836f30fca990e58bcc0fd077/base/process/process_unittest.cc
[modify] https://crrev.com/ec32f1828e254a45836f30fca990e58bcc0fd077/testing/buildbot/filters/fuchsia.base_unittests.filter

From what I can tell, on Windows, we use custom return codes to handle this, defined in:
https://cs.chromium.org/chromium/src/base/process/kill.h?type=cs&l=29

Any reason why we couldn't use the same mechanism?
Cc: fdegans@chromium.org

Comment 8 by w...@chromium.org, May 16 2018

Re #6: Those constants represent specific exit-code values that Windows itself reports when a process exits in a particular way (e.g. certain kinds of crash), I think.

This bug is about being able to have a process we're forcibly terminating have a specific exit-code reported to its parent. Perhaps that could be a property on the process object rather than a parameter to zx_task_kill() (since exit-code is a process-level concept).
Not all of them seem to be Windows codes. kOomExceptionCode is thrown manually for instance:
https://cs.chromium.org/chromium/src/base/process/memory_win.cc?type=cs&l=55

I think these values are actually incorrect on Windows. I tracked down when they were added back to the initial commit for base, before there was a Windows-specific source:
https://chromium.googlesource.com/chromium/src/+/d7cae12696b96500c05dd2d430f6238922c20c96/base/process_util.cc#197
I think these are POSIX values that were not ported properly to Windows when the file was divided for multiple platforms.

Back to the subject at hand, I agree that relying on the process return code is not a great idea in general but it's something we do on other platforms anyway.
Summary: See if Fuchsia wants to support an exit code on zx_task_kill() (was: See if Fuchsia wants to support an exit code on mx_task_kill())
After a bit more digging and offline chat with wez@, it seems the values are actually correct but undocumented on MSDN. wez@ suggested looking into the Windows Driver Development Kit for proper doc but this is beyond the scope of this bug anyway.

On-topic, how does Zircon handle a crashing process and especially how does it handle the process return value, if at all?
xref to ZX-1974 upstream
Project Member

Comment 13 by bugdroid1@chromium.org, Jun 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/62c715550ee24d8b24ef1069819719c2d3abafb0

commit 62c715550ee24d8b24ef1069819719c2d3abafb0
Author: Fabrice de Gans-Riberi <fdegans@chromium.org>
Date: Mon Jun 18 19:36:35 2018

Filter out all remaining base tests on Fuchsia.

This removes all the remaining disabled tests in the filter file for
base tests on Fuchsia and instead filters each of them individually.

Bug: 738275, 752368, 753490, 810077, 811881, 851734, 851747, 851759, 851760
Change-Id: I375954138d09ebacc05b2ad37afe1e09901e52e2
Reviewed-on: https://chromium-review.googlesource.com/1096483
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568112}
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/allocator/partition_allocator/address_space_randomization_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/files/file_proxy_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/files/file_util_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/message_loop/message_loop_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/metrics/field_trial_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/observer_list_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/process/process_util_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/synchronization/condition_variable_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/sys_info_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/threading/platform_thread_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/trace_event/process_memory_dump_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/base/trace_event/trace_category_unittest.cc
[modify] https://crrev.com/62c715550ee24d8b24ef1069819719c2d3abafb0/testing/buildbot/filters/fuchsia.base_unittests.filter

Cc: scottmg@chromium.org
Owner: ----
Status: Available (was: Assigned)

Sign in to add a comment