Skip to content

Commit

Permalink
Merge pull request #50 from ddosify/fix/h2-chan
Browse files Browse the repository at this point in the history
add panic recover
  • Loading branch information
fatihbaltaci authored Nov 23, 2023
2 parents 83b4b95 + f9b9d24 commit 3fb6927
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 6 additions & 2 deletions aggregator/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ func (a *Aggregator) getConnKey(pid uint32, fd uint64) string {
func (a *Aggregator) processL7(ctx context.Context, d l7_req.L7Event) {
// other protocols events come as whole, but http2 events come as frames
// we need to aggregate frames to get the whole request
defer func() {
if r := recover(); r != nil {
// TODO: we need to fix this properly
log.Logger.Debug().Msgf("probably a http2 frame sent on a closed chan: %v", r)
}
}()

if d.Protocol == l7_req.L7_PROTOCOL_HTTP2 {
var ok bool
Expand Down Expand Up @@ -968,8 +974,6 @@ func (a *Aggregator) findRelatedSocket(ctx context.Context, d *l7_req.L7Event) *

}
func parseSqlCommand(r []uint8) string {
log.Logger.Debug().Uints8("request", r).Msg("parsing sql command")

// Q, 4 bytes of length, sql command

// skip Q, (simple query)
Expand Down
6 changes: 0 additions & 6 deletions ebpf/l7_req/l7.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,6 @@ int process_exit_of_syscalls_read_recvfrom(void* ctx, __u64 id, __u32 pid, __s64
}
}
}else{
unsigned char log_msg[] = "read buffer is null or too small -- ||";
log_to_userspace(ctx, DEBUG, func_name, log_msg, 0, 0, 0);

bpf_map_delete_elem(&active_reads, &id);
return 0;
}
Expand Down Expand Up @@ -1234,9 +1231,6 @@ int BPF_UPROBE(go_tls_conn_read_exit) {
return 0;
}
}else{
unsigned char log_msg[] = "read buffer is null or too small -- |goid|method";
log_to_userspace(ctx, DEBUG, func_name, log_msg, 0, k.goid, e->method);

bpf_map_delete_elem(&go_active_reads, &k);
return 0;
}
Expand Down

0 comments on commit 3fb6927

Please sign in to comment.