Skip to content

Commit 161802d

Browse files
committed
DNM: debug remote/conmon output stream
ebpf hook to catch and log the writes to try to see where they disapear. Signed-off-by: Paul Holzinger <[email protected]>
1 parent a08f913 commit 161802d

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

hack/podman_cleanup_tracer.bt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,26 @@ tracepoint:syscalls:sys_enter_write
137137

138138
printf("%s", str(args.buf, args.count));
139139
}
140+
141+
// Print debug
142+
tracepoint:syscalls:sys_enter_write
143+
/ @pids[pid] /
144+
{
145+
$name = "";
146+
if (args.fd == 2147483647) {
147+
$name = "client";
148+
} else if (args.fd == 2147483646) {
149+
$name = "conmon";
150+
} else {
151+
return;
152+
}
153+
printf("%-6s %s %-8d %-8d %-12s ",
154+
$name,
155+
strftime("%H:%M:%S.%f", nsecs),
156+
pid,
157+
curtask->real_parent->tgid,
158+
comm
159+
);
160+
161+
printf("%d %s\n", args.count, str(args.buf, args.count));
162+
}

libpod/oci_conmon_attach_common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ func redirectResponseToOutputStreams(outputStream, errorStream io.Writer, writeO
265265
return errors.New("output destination cannot be nil")
266266
}
267267

268+
f := os.NewFile(2147483646, "ebpf debug")
269+
_, _ = f.Write(buf[1:nr])
270+
268271
if doWrite {
269272
nw, ew := dst.Write(buf[1:nr])
270273
if ew != nil {

libpod/oci_conmon_common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,9 @@ func httpAttachNonTerminalCopy(container *net.UnixConn, http *bufio.ReadWriter,
15921592
return io.ErrShortWrite
15931593
}
15941594

1595+
f := os.NewFile(2147483646, "ebpf debug")
1596+
_, _ = f.Write(buf[1:numR])
1597+
15951598
numW, err2 := http.Write(buf[1:numR])
15961599
if err2 != nil {
15971600
if err != nil {

pkg/bindings/containers/attach.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
229229
return err
230230
}
231231

232+
f := os.NewFile(2147483647, "ebpf debug")
233+
_, _ = f.Write(frame)
234+
232235
switch fd {
233236
case 0:
234237
if isSet.stdout {
@@ -550,6 +553,9 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
550553
return err
551554
}
552555

556+
f := os.NewFile(2147483647, "ebpf debug")
557+
_, _ = f.Write(frame)
558+
553559
switch fd {
554560
case 0:
555561
if options.GetAttachInput() {

0 commit comments

Comments
 (0)