Skip to content

core: add missing extension registration#24750

Merged
Augustyniak merged 2 commits intomainfrom
add-missing-connection-handler-registration
Jan 4, 2023
Merged

core: add missing extension registration#24750
Augustyniak merged 2 commits intomainfrom
add-missing-connection-handler-registration

Conversation

@Augustyniak
Copy link
Copy Markdown
Contributor

Commit Message: A follow up fixes to #24495. Without these fixes application crashes after addDirectResponse call on TestEngineBuilder (iOS only api) as the handler_ in

handler_->addListener(overridden_listener, listener, runtime);
is nullptr.
Additional Description: The question is whether without the added registration calls application may crash even without the addDirectResponse call. cc @alyssawilk. Asking since Lyft has pushed #24495 to prod pipeline already and the question is whether we need to cherry-pick the fix from this PR now.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Rafal Augustyniak raugustyniak@lyft.com

Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #24750 was opened by Augustyniak.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/mobile-maintainers: FYI only for changes made to (mobile/).
envoyproxy/mobile-maintainers assignee is @alyssawilk

🐱

Caused by: #24750 was opened by Augustyniak.

see: more, trace.

@Augustyniak Augustyniak marked this pull request as ready for review January 4, 2023 04:41
Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
@Augustyniak
Copy link
Copy Markdown
Contributor Author

@alyssawilk the crash I observed was happening when we were trying to add a listener

void WorkerImpl::addListener(absl::optional<uint64_t> overridden_listener,
. That's something that we do only in our tests so it should not impact "real" apps but I wonder whether you can see any other cases for when the EM would crash (without the fix from this PR) if the application does not add/remove listeners?

@alyssawilk
Copy link
Copy Markdown
Contributor

Legacy add direct response doesn't serve a direct response but instead proxies to the loopback listener, which wouldn't play well when missing a connection handler. That said I thought I fixed the proxying for add direct response in #24402 so I'm not clear why adding a direct response would trigger this path any more :-/

@Augustyniak
Copy link
Copy Markdown
Contributor Author

looking at the EnvoyConfiguration.m:

if (hasDirectResponses) {
templateYAML = [templateYAML stringByReplacingOccurrencesOfString:@"#{fake_remote_responses}"
withString:self.directResponses];
[customClusters appendString:[[NSString alloc] initWithUTF8String:fake_remote_cluster_insert]];
[customListeners
appendString:[[NSString alloc] initWithUTF8String:fake_remote_listener_insert]];
[customRoutes appendString:self.directResponseMatchers];
[customFilters
appendString:[[NSString alloc] initWithUTF8String:route_cache_reset_filter_insert]];
}

I think that we are still injecting the fake listener for cases when direct responses are defined. We replace #{custom_listeners} substring

#{custom_listeners}
with the list of listeners (that includes the fake listener) in here
templateYAML = [templateYAML stringByReplacingOccurrencesOfString:@"#{custom_listeners}"
withString:customListeners];

@alyssawilk
Copy link
Copy Markdown
Contributor

ahhh, that'd do it. How would you folks feel about removing that listener overall, if I can sort out all the tests? I'd planned on doing it as a follow up but didn't want to rush things in case y'all had other deps on it

@Augustyniak
Copy link
Copy Markdown
Contributor Author

Removing the listener sounds fine 👍

@alyssawilk Do you think that having #24495 without having whatever is in this PR fine for cases when EM does not add direct responses? I am asking since we pushed exactly that (#24495 without the registration calls) to our prod release pipeline yesterday and I am trying to determine whether I need to patch that pushed version with the fix from this PR to avoid crashing our apps? I cannot repro a crash without addDirectResponse call but maybe you can think of any other case when such crash would happen?

@alyssawilk
Copy link
Copy Markdown
Contributor

So this is all code which shouldn't be accessed by E-M (which is why I'm trying to remove it) but as you say the direct response path is inadvertently using it when I thought it was fixed, so I'd lean towards erring on the side of caution and cherry picking. I'm sorry I missed yet another force-register :-(

@Augustyniak Augustyniak merged commit d2fe5cc into main Jan 4, 2023
@Augustyniak Augustyniak deleted the add-missing-connection-handler-registration branch January 4, 2023 15:07
ohadvano pushed a commit to ohadvano/envoy that referenced this pull request Jan 5, 2023
Commit Message: A follow up fixes to envoyproxy#24495. Without these fixes application crashes after `addDirectResponse` call on `TestEngineBuilder` (iOS only api) as the `handler_` in https://github.com/envoyproxy/envoy/blob/93ea91f42ef749a4560a4596174402a5aad8ee65/source/server/worker_impl.cc#L61 is `nullptr`.
Additional Description: The question is whether without the added registration calls application may crash even without the `addDirectResponse` call. cc @alyssawilk. Asking since Lyft has pushed envoyproxy#24495 to prod pipeline already and the question is whether we need to cherry-pick the fix from this PR now.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
Signed-off-by: Ohad Vano <ohadvano@microsoft.com>
VishalDamgude pushed a commit to freshworks-oss/envoy that referenced this pull request Feb 1, 2023
Commit Message: A follow up fixes to envoyproxy#24495. Without these fixes application crashes after `addDirectResponse` call on `TestEngineBuilder` (iOS only api) as the `handler_` in https://github.com/envoyproxy/envoy/blob/93ea91f42ef749a4560a4596174402a5aad8ee65/source/server/worker_impl.cc#L61 is `nullptr`.
Additional Description: The question is whether without the added registration calls application may crash even without the `addDirectResponse` call. cc @alyssawilk. Asking since Lyft has pushed envoyproxy#24495 to prod pipeline already and the question is whether we need to cherry-pick the fix from this PR now.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
Signed-off-by: VishalDamgude <vishal.damgude@freshworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants