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

upstream_conn: fix ordering of mk_event_inject and prepare_conn_destroy #6842

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/flb_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ int flb_upstream_conn_timeouts(struct mk_list *list)
{
time_t now;
int drop;
int inject;
struct mk_list *head;
struct mk_list *u_head;
struct mk_list *tmp;
Expand Down Expand Up @@ -842,13 +843,21 @@ int flb_upstream_conn_timeouts(struct mk_list *list)
}

if (drop == FLB_TRUE) {
inject = FLB_FALSE;
if (u_conn->event.status != MK_EVENT_NONE) {
inject = FLB_TRUE;
}
u_conn->net_error = ETIMEDOUT;
prepare_destroy_conn(u_conn);
/*
* prepare_destroy_conn calls mk_list_del on the event in the
* priority bucket queue, so for safety, we inject it afterwards
*/
if (inject == FLB_TRUE) {
mk_event_inject(u_conn->evl, &u_conn->event,
MK_EVENT_READ | MK_EVENT_WRITE,
FLB_TRUE);
}
u_conn->net_error = ETIMEDOUT;
prepare_destroy_conn(u_conn);
}
}

Expand Down