envoyproxy/envoy

bug: lambda captures destruction order not determined.

Open

#7.184 geöffnet am 5. Juni 2019

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (5.373 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (27.997 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)

Beschreibung

Title: [BUG] lambda captures destruction order not determined in http ConnectionManagerImpl factory callback.

Description:

In envoy/source/extensions/filters/network/http_connection_manager/config.cc when return the ConnectionManagerImpl factory callback, the created HttpConnectionManagerConfig instance "filter_config" takes reference of objects held by shared_ptr route_config_provider_manager and date_provider etc.

Per https://en.cppreference.com/w/cpp/language/lambda the order of captures construction(so destruction as well) is not determined. This may cause issue during destruction of the "filter_config" object.

Repro steps:

It's kinda hard to reproduce as it's compiler dependent. but a easy fix is to fix the order by capturing them in a temp struct or something similar before diving into the lambda.

Note: N/A

Admin and Stats Output: N/A Config: N/A

Logs:N/A Call Stack:N/A

Contributor Guide