Skip to content

Improve construction of ProcessImpl #735

@mum4k

Description

@mum4k

PR #734 changed how ProcessImpl is constructed.

The construction is non-trivial, because of a circular dependency. As described in the code:

  // Ideally we would create the bootstrap first and then pass it to the
  // constructor of Envoy::Api::Api. That cannot be done because of a circular
  // dependency:
  // 1) The constructor of Envoy::Api::Api requires an instance of Bootstrap.
  // 2) The bootstrap generator requires an Envoy::Event::Dispatcher to resolve
  //    URIs to IPs required in the Bootstrap.
  // 3) The constructor of Envoy::Event::Dispatcher requires Envoy::Api::Api.
  //
  // Replacing the bootstrap_ after the Envoy::Api::Api has been created is
  // assumed to be safe, because we still do it while constructing the
  // ProcessImpl, i.e. before we start running the process.

As a workaround ProcessImpl::CreateProcessImpl creates Envoy::Api::Api with an empty Bootstrap, the uses that API to generate the Bootstrap and patches it back in. This doesn't have any functional impact, since all of this happens during construction of Process, but is non-trivial and non-intuitive.

This issue is opened to discuss ideas for impromevent.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions