support to print stack#3667
Conversation
a1c06f2 to
72a0fc3
Compare
5f601d8 to
cd8064c
Compare
c705620 to
ebaf740
Compare
|
but after unix.Close(l.logFd) at standard_init_linux.go , I can't use logrus to print stack, this will miss some messages @kolyshkin |
Yes, since the logs are being forwarded to the parent, the parent has to live until there are logs. Previously (before #2835) sometimes the parent was exiting prematurely, resulting in some logs being lost. Now, we do wait for the child to close the log fd, to make sure all the logs are forwarded. All it means for this case is it's not possible to use logrus from runc init after closing the logs. I am not sure how to handle this, perhaps the bold approach would be to remove logs forwarding goroutine entirely, instead passing the logrus fd directly to init. This needs some thinking and experimenting though |
This might work, but we need to teach the C code to work the same way as logrus -- meaning, produce either text or json, depending on settings and whether fd is a terminal. |
I don't understand "the bold approach would be to remove logs forwarding goroutine entirely" can you explain it ? |
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
For In theory, we can remove this log forwarding, instead passing the log file descriptor to C code, and log directly from there. |
Signed-off-by: ningmingxiao ning.mingxiao@zte.com.cn
sometimes runc is hanged ,this will show where hang