1 Overview
在啓動 Spark Operator 的時候出現了一個意想不到的問題。
[root@sholdmix01node1 /data/runzhliu/spark]# kubectl log -n kube-system spark-sparkoperator-86f6c889cd-ggbmc
log is DEPRECATED and will be removed in a future version. Use logs instead.
++ id -u
+ myuid=185
++ id -g
+ mygid=0
+ set +e
++ getent passwd 185
+ uidentry=
+ set -e
+ echo 185
185
0
+ echo 0
+ echo
+ [[ -z '' ]]
+ [[ -w /etc/passwd ]]
+ echo '185:x:185:0:anonymous uid:/opt/spark:/bin/false'
+ exec /usr/bin/tini -s -- /usr/bin/spark-operator
[FATAL tini (9)] tcsetpgrp failed: Permission denied
因爲本人在騰訊,這是因爲開發環境的 tlinux 的問題,導致 tini
出錯了。尋找了很久,也沒找到 特別有效的信息,於是查看一下 tini
的源碼,看看 這個 錯誤是如何產生的。
2 tini 源碼
大家可以看到這行代碼,錯誤信息就是由他打印的。
// Doing it in the child process avoids a race condition scenario
// if Tini is calling Tini (in which case the grandparent may make the
// parent the foreground process group, and the actual child ends up...
// in the background!)
if (tcsetpgrp(STDIN_FILENO, getpgrp())) {
if (errno == ENOTTY) {
PRINT_DEBUG("tcsetpgrp failed: no tty (ok to proceed)");
} else if (errno == ENXIO) {
// can occur on lx-branded zones
PRINT_DEBUG("tcsetpgrp failed: no such device (ok to proceed)");
} else {
PRINT_FATAL("tcsetpgrp failed: %s", strerror(errno));
return 1;
}
}
可以直接把這段代碼註釋掉,然後重新編譯 cmake . && make
。
3 Summary
將重新編譯後的 tini
替換原來鏡像的 tini
即可。