Skip to content

udp: do not close listen socket after stop listening - #19146

Merged
mattklein123 merged 8 commits into
envoyproxy:mainfrom
danzh2010:admindrain
Dec 9, 2021
Merged

mattklein123 merged 8 commits into
envoyproxy:mainfrom
danzh2010:admindrain

Conversation

@danzh2010

@danzh2010 danzh2010 commented Dec 1, 2021 •

Copy link
Copy Markdown
Contributor

Commit Message: After stopListener(), only close all the listen socket of that listen if the listener is not quic.

Risk Level: low, only quic is affected
Testing: re-enabled QuicHttpIntegrationTest::AdminDrainDrainsListeners, added unit test

Fixes #19006

@RyanTheOptimist RyanTheOptimist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

Comment thread source/server/listener_manager_impl.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since we have this (almost) identical block of logic twice, could we have a method like maybeCloseAllSockets(ListenerImplPtr listener) which wraps this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo hoo!

Would it make sense to try to write a unit test for the new logic in source/server/listener_manager_impl.cc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Signed-off-by: Dan Zhang <[email protected]>
Signed-off-by: Dan Zhang <[email protected]>
Signed-off-by: Dan Zhang <[email protected]>
@danzh2010

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19146 (comment) was created by @danzh2010.

see: more, trace.

@RyanTheOptimist RyanTheOptimist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Any idea what's up with the failed tests? Flakes, perhaps?

@danzh2010

Copy link
Copy Markdown
Contributor Author

coverage and api CIs failed in my other PRs as well, the failing test kill_request:kill_request_filter_integration_test is not related to this change.

@danzh2010

Copy link
Copy Markdown
Contributor Author

CI failures are gone after sync'ing with HEAD. PTAL

RyanTheOptimist
RyanTheOptimist previously approved these changes Dec 7, 2021
@RyanTheOptimist

Copy link
Copy Markdown
Contributor

/assign @alyssawilk

@danzh2010

Copy link
Copy Markdown
Contributor Author

/assign @mattklein123

@alyssawilk alyssawilk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm modulo minor comment nits

Comment thread source/server/listener_manager_impl.cc Outdated
if (!listener.udpListenerConfig().has_value() ||
listener.udpListenerConfig()->listenerFactory().isTransportConnectionless()) {
// Close the listen socket right away to avoid leaving TCP connections in accept queue
// already waiting for long timeout. However, connection-oriented UDP listener shouldn't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: UDP listener -> UDP listeners

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread source/server/listener_manager_impl.cc Outdated
listener.udpListenerConfig()->listenerFactory().isTransportConnectionless()) {
// Close the listen socket right away to avoid leaving TCP connections in accept queue
// already waiting for long timeout. However, connection-oriented UDP listener shouldn't
// close the socket because it needs to receive packets on existing connection via the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it needs to -> they need to
on existing connection -> for existing connections

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: Dan Zhang <[email protected]>
@danzh2010

Copy link
Copy Markdown
Contributor Author

ping @mattklein123

@RyanTheOptimist

Copy link
Copy Markdown
Contributor

I think Matt it out on paternity leave. Once alyssa is happy, I think we should be good to go?

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for the back and forth discussion on this one. I think this is the right fix.

@mattklein123
mattklein123 merged commit 63d2d0f into envoyproxy:main Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuicHttpIntegrationTest.AdminDrainDrainsListeners is flaky

5 participants