-
Notifications
You must be signed in to change notification settings - Fork 119
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
Fix missing events from httpfilter #136
Conversation
ENTRYPOINT ["/greetings"] | ||
#CMD [ "strace", "-f", "/greetings" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping this commented out for now because it's handy for debugging the tests with the kprobes.
@@ -15,7 +14,7 @@ async fn greeting(item: web::Json<MyObj>) -> HttpResponse { | |||
} | |||
|
|||
async fn smoke() -> HttpResponse { | |||
HttpResponse::Ok().content_type(ContentType::plaintext()).body("hello") | |||
HttpResponse::Ok().into() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed any content reporting, just send empty 200 OK response.
network_mode: "service:rusttestserver" | ||
pid: "host" | ||
network_mode: "service:testserver" | ||
pid: "service:testserver" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this to "host" by mistake, we should try harder :).
Codecov Report
@@ Coverage Diff @@
## main #136 +/- ##
===========================================
+ Coverage 40.36% 66.82% +26.45%
===========================================
Files 30 30
Lines 2056 2107 +51
===========================================
+ Hits 830 1408 +578
+ Misses 1169 584 -585
- Partials 57 115 +58
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Thanks Mario! |
Fix missing events from httpfilter
While working on the integration tests for Rust I noticed a strange edge case, if the Rust server wasn't sending any data back on an API call, like our '/smoke' API, we weren't catching the smoke events. In my tests I had to add a fake plaintext response to make the tests pass.
After digging further I found out that the actix web framework has an optimisation, if you send multiple identical requests that don't have any response, it reuses the last accepted connection, so technically it doesn't call the accept4 syscall, nor it allocates a new socket, if the connection is not closed.
Since sometimes we might miss the first accept call based on timing, we weren't capturing the /smoke API calls, since we never found a filtered connection info. To mitigate this I added a kprobe on
tcp_rcv_established
which will establish the filtered connection info if there's not one already. Accept and connect are allowed to overwrite this info, so technically it's there only if we never saw an accept happen. I don't think this can happen with a client call, but I'll experiment more and see if I have to worry about client calls and matching what kind of request is established. Right now if it's missing we assume a server request.I also reworked some of the docker compose files for Java and Rust. Naming things as rusttestserver was problematic when we use
make cleanup-integration-test
which I had to do a lot of :). The cleanup uses the regular docker-compose.yaml, and if the names don't match we don't bring down all of the containers.