mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Bannier <>
Subject Re: Review Request 46822: Avoided slicing of flags in subprocess.
Date Sun, 03 Jul 2016 15:22:28 GMT

This is an automatically generated e-mail. To reply, visit:

(Updated July 3, 2016, 5:22 p.m.)

Review request for mesos, Alexander Rukletsov, Joris Van Remoortere, Michael Park, and Vinod



Bugs: MESOS-3335

Repository: mesos


While `FlagsBase` internally stores just maps of names and
flags, the functions stored in a `Flag` rely on the original type of
the `Flags` containing them (e.g., we perform dynamic casts to detect
their types).

Since `Option<T>` stores `T` as a value (i.e., it cannot contain
reference types) any interface taking an `Option<T>` cannot rely on
polymorphic behavior of `T`. To make use of polymorphism we should
instead store e.g., a pointer type to avoid slicing.

Here we change `Flags` arguments of `subprocess` to allow preserving
the original type so `Flag` function can work reliably. We do this by
passing a `Shared<Flags>` so we do not restrict copying; not that it
would also be possible to use an `Owned<Flags>`, but this would
require an audit of all sites where the arguments are used as
`Owned<T>` should not be copied, but do not prevent that on their own.

Diffs (updated)

  src/slave/container_loggers/lib_logrotate.cpp d53847bbca83367927725f06e8f962ce7011f468 
  src/slave/containerizer/docker.cpp 915030bdbe5a5b55acc38042ee0475074a602ee0 
  src/slave/containerizer/mesos/containerizer.cpp a96b382f22886362a1159e1166dfe041072985ba

  src/slave/containerizer/mesos/isolators/network/cni/cni.cpp 92b33111799cb4e1c8bc2051381e1254d701d95c

  src/slave/containerizer/mesos/isolators/network/port_mapping.cpp 25d2a57d7a814d735db78bda8c6956199de5c390

  src/slave/containerizer/mesos/launcher.hpp 05320f462653c31fc2f093d6c67e2182e9c794fa 
  src/slave/containerizer/mesos/launcher.cpp ff675262af8947b89f8099828665e5e5d86491d8 
  src/slave/containerizer/mesos/linux_launcher.hpp 89bb2958a41dffe4ade9c2492b9a7412f90a432d

  src/slave/containerizer/mesos/linux_launcher.cpp 5028854fa003615f158120e030866b7ec4402b66

  src/tests/containerizer/launch_tests.cpp 3e36f2f7ab89b98de2c1a971e4ecca58c13ad642 
  src/tests/containerizer/launcher.hpp c352634c4766d289706c7cc738677619d7d02ccd 
  src/tests/containerizer/port_mapping_tests.cpp 1c50cf545392488cf1e2d51d8e03887bebef5e75



Tested on various platforms in internal CI.


Benjamin Bannier

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message