Skip to content
Snippets Groups Projects
Forked from hexang-mirrors / Fuchsia OS
Loading
user avatar
Nick Maniscalco authored
PortDispatcher is retained by its PortObservers. Prior to this change,
PortDispatchers were not freed until the source Dispatcher was
canceled or closed. This made it easy to "leak" PortDispatcher and
PortObserver objects.

Now, when PortDispatcher's handle count drops to zero, it cancels the
observed source dispatchers and frees all PortObservers that might be
retaining it.

Testing:

1. Manually verified that port dispatchers are freed by running a test
(as described in ZX-3379) that continually creates a port, does an
object_wait_async, then closes the port. Watched kcounters and
observed the number of port dispatchers did not grow without bound.

2. Ran port-test's cancel_stress on x64/qemu+kvm and arm64/qemu+kvm
with a high kStressCount.

3. Ran port-test's new signal_close_stress on x64/qemu+kvm for several
minutes.

4. Ran fuchsia tests under lockdep and verified no new lockdep
issues (build with "ENABLE_LOCK_DEP := true" in local.mk, "fx run -k",
then "runtests").

Performance:

Ran port related zircon_benchmarks on Eve (--filer=Port). While
results varied from run to run both at HEAD and with this patch, no
consistent performance regression were observed (i.e. sometimes HEAD
was faster, sometimes this patch was faster).

Bug: ZX-3379 #done
Test: various tests described above
Change-Id: I9aa80844415c932f755d6818d3b38e24ccec89cd
74212bea
Name Last commit Last update