Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listener: fix a crash when updating any listener that does not bind to port #18421

Merged
merged 17 commits into from
Oct 7, 2021

Conversation

lambdai
Copy link
Contributor

@lambdai lambdai commented Oct 5, 2021

Commit Message:
Fix the crash caused by listener update when the any listener set bind_to_port to false.
A listener does not bind to port has no io handle. close() already check it.
Now add the check to isOpen().

Also the Tcp(or Udp)ListenSocket::duplicate() creates parent ListenSocketImpl
Make it returning the derived ListenSocket, either TcpListenSocket or UdpListenSocket

Additional Description:
Risk Level:
Testing: Unit test on duplicate. Integration test on bind_to_port.
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: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai lambdai changed the title Fixduplicate Listener: fix a crash when updating any listener that does not bind to port Oct 5, 2021
@mandarjog
Copy link
Contributor

@lizan since this is blocking istio-proxy from picking up the change.

@mandarjog
Copy link
Contributor

ref: istio/istio#34188

@mattklein123 mattklein123 self-assigned this Oct 5, 2021
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks generally LGTM with small comments.

/wait

source/common/network/listen_socket_impl.h Outdated Show resolved Hide resolved
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Contributor Author

lambdai commented Oct 5, 2021

/retest

@repokitteh-read-only
Copy link

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

🐱

Caused by: a #18421 (comment) was created by @lambdai.

see: more, trace.

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks, one question.

/wait-any

source/common/network/listen_socket_impl.h Outdated Show resolved Hide resolved
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@mattklein123
Copy link
Member

LGTM but unfortunately needs another main merge.

/wait

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

LGTM but unfortunately needs another main merge.

/wait

Thanks! Just did it

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

@mattklein123 Thank you for the fast and friendly collaboration!

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

I see conflict show up again at WebUI but my origin/main is updated. I will keep watch on this

@lizan
Copy link
Member

lizan commented Oct 6, 2021

@lambdai do we want to backport this to 1.20.x?

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

@lambdai do we want to backport this to 1.20.x?

yes, I plan to propose /backport when this is merged.

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

Should I do it earlier?

@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

/backport

@repokitteh-read-only repokitteh-read-only bot added the backport/review Request to backport to stable releases label Oct 6, 2021
@lambdai
Copy link
Contributor Author

lambdai commented Oct 6, 2021

@lizan @mathetake This is 1.20 only and it's critical for istio release See istio/istio#34188

I can create the PR when this one is merged. WDTY?

@mattklein123 mattklein123 merged commit e84987c into envoyproxy:main Oct 7, 2021
@lambdai lambdai deleted the fixduplicate branch October 7, 2021 16:33
lambdai added a commit to lambdai/envoy-dai that referenced this pull request Oct 7, 2021
…o port (envoyproxy#18421)

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lizan
Copy link
Member

lizan commented Oct 7, 2021

@mathetake is OOO

Yes we should backport this to 1.20.x

mathetake pushed a commit that referenced this pull request Oct 18, 2021
…o port (#18421) (#18505)

backport e84987c to v1.20

Fix the crash caused by listener update when the any listener set bind_to_port to false.
A listener does not bind to port has no io handle. close() already check it.
Now add the check to isOpen().

Also the Tcp(or Udp)ListenSocket::duplicate() creates parent ListenSocketImpl
Make it returning the derived ListenSocket, either TcpListenSocket or UdpListenSocket

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@alyssawilk alyssawilk added backport/approved Approved backports to stable releases and removed backport/review Request to backport to stable releases labels Nov 29, 2021
aidanhahn pushed a commit to datawire/envoy that referenced this pull request Jan 13, 2022
…o port (envoyproxy#18421) (envoyproxy#18505)

backport e84987c to v1.20

Fix the crash caused by listener update when the any listener set bind_to_port to false.
A listener does not bind to port has no io handle. close() already check it.
Now add the check to isOpen().

Also the Tcp(or Udp)ListenSocket::duplicate() creates parent ListenSocketImpl
Make it returning the derived ListenSocket, either TcpListenSocket or UdpListenSocket

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/approved Approved backports to stable releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants