listener: clean up accept filter before creating connection#8922
listener: clean up accept filter before creating connection#8922mattklein123 merged 5 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for digging into this. I realize the urgency around this so a TODO/issue is fine for follow up, but optimally we would have some integration test that covers this, or at minimum some unit test. Can you try to add something to this PR or if not TODO that also? Thanks.
/wait
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
test/mocks/network/mocks.cc
Outdated
| MockListenerFilter::MockListenerFilter() = default; | ||
| MockListenerFilter::~MockListenerFilter() = default; | ||
| MockListenerFilter::MockListenerFilter() { | ||
| // ON_CALL(*this, die_()).WillByDefault(testing::Invoke([](){})); |
There was a problem hiding this comment.
I don't really know why ON_CALL + NiceMock reports uninterested call.
I add explicit EXPECT_CALL in each usage. That's a tech debt.
I will investigate later
There was a problem hiding this comment.
It doesn't work in the destructor of a mock. We do this all over the place. Please delete this comment.
There was a problem hiding this comment.
Sad...During the constructor or destructor of MockFoo, the mock object is not nice or strict
mattklein123
left a comment
There was a problem hiding this comment.
LGTM with small nits, thanks.
/wait
test/mocks/network/mocks.cc
Outdated
| MockListenerFilter::MockListenerFilter() = default; | ||
| MockListenerFilter::~MockListenerFilter() = default; | ||
| MockListenerFilter::MockListenerFilter() { | ||
| // ON_CALL(*this, die_()).WillByDefault(testing::Invoke([](){})); |
There was a problem hiding this comment.
It doesn't work in the destructor of a mock. We do this all over the place. Please delete this comment.
test/mocks/network/mocks.h
Outdated
| MockListenerFilter(); | ||
| ~MockListenerFilter() override; | ||
|
|
||
| MOCK_METHOD0(die_, void()); |
There was a problem hiding this comment.
s/die_/destroy which is what we typically name this method
There was a problem hiding this comment.
Updating...
Looks like destroy_ w/ underscore is preferred since it is added in MockClass
|
Thanks! Running test locally. Update in 5 minutes |
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com> Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Yuchen Dai silentdai@gmail.com
Description:
When listener continue to accept connection on listener filter timeout, the OS socket fd could be owned by two separate FileEventImpl.
The destructing FileEventImpl cannot recover the intention of the alive FileEventImpl.
The observation is that EdgeTrigger flag is cleared and the fd will be LevelTriggered and the EPOLLOUT will be activated in each epoll_wait
immediately after the invoke.
Envoy worker thread owning that connecting will be consuming 1 cpu core in the repeated epoll_wait.
This PR is maintaining the immutability that at most one FileEventImpl could owns the fd so the assigned event always match the expectation
of FileEventImpl.
Before this PR
With this PR
The proof that
EPOLLIN|EPOLLOUTw/o EPOLLET is registered due to ~FileEventImplBelow
fd 21 op 3 event_uaddr 5is recognized asepoll_ctl( ..., EPOLL_MOD, 21, { EPOLLIN|EPOLLOUT, {...}})where EPOLLET (1 << 31) is missing.fd 21 is the English spelling of 26 since I capture the logs in different run.
Risk Level:
Testing:
Docs Changes:
Release Notes:
Fix istio/istio#18229