eunomia-bpf / bpftime

Userspace eBPF runtime for Observability, Network & General Extensions Framework
https://eunomia.dev/bpftime/
MIT License
788 stars 74 forks source link

[BUG] when being attached by bpftime, bash will stuck if it spawns another bash process #289

Closed Officeyutong closed 4 months ago

Officeyutong commented 4 months ago

Repdocuce:

Now everything works well. But if we run bash in the attached bash, it will stuck and won't handle any input, until a SIGINT (Ctrl+C) was sended

Officeyutong commented 4 months ago

Some initial investigations:

Why?

If we run bpftime start /bin/bash --norc, everything works well. But if we run bash in the started shell, bash will stuck for a few seconds, prints bash: /usr/bin/dirname: Argument list too long and continues to stuck. And no logs will be printed for the new bash process.

So one guess is all logs printed by bpftime has gone to stdout, and they were eaten by a certain program that invokes bash (for example bash calls itself in bashrc), but that program was unable to process such unexpected stdout contents and just stuck.

If we still spawn bash with --norc in the spawned bash, everything still works well. So the key piece must be in some calls in bashrc