datawire / envoy-extauth

The original out-of-tree version of the Envoy ext_authz filter (historical interest only)
https://www.envoyproxy.io/docs/envoy/v1.22.2/api-v3/extensions/filters/http/ext_authz/v3/ext_authz.proto.html
9 stars 7 forks source link

Perform proper filter cleanup in `onDestroy()` #2

Closed ark3 closed 7 years ago

ark3 commented 7 years ago

It appears this assertion on line 15 of extauth.cc is incorrect:

ExtAuth::~ExtAuth() { ASSERT(!auth_request_); }

We should rethink it and probably remove it.

ark3 commented 7 years ago

The assertion is not incorrect. That it sometimes fails is a symptom of the fact that the proper cleanup is not being performed by ExtAuth::onDestroy().

From include/envoy/http/filter.h:

  /**
   * This routine is called prior to a filter being destroyed. This may happen after normal stream
   * finish (both downstream and upstream) or due to reset. Every filter is responsible for making
   * sure that any async events are cleaned up in the context of this routine. This includes timers,
   * network calls, etc. The reason there is an onDestroy() method vs. doing this type of cleanup
   * in the destructor is due to the deferred deletion model that Envoy uses to avoid stack unwind
   * complications.
   */

Updating the issue title.