我在自己的电脑上尝试使用相同的操作系统和Python版本来运行这个TensorFlow分布式教程。我创建了第一个脚本并在终端中运行,然后我打开另一个终端运行第二个脚本,得到以下错误:
E0629 10:11:01.979187251 15265 tcp_server_posix.c:284] bind addr=[::]:2222: Address already in useE0629 10:11:01.979243221 15265 server_chttp2.c:119] No address added out of total 1 resolvedTraceback (most recent call last):File "worker0.py", line 7, in <module>task_index=0)File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/server_lib.py", line 142, in __init__server_def.SerializeToString(), status)File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__self.gen.next()File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors.py", line 450, in raise_exception_on_not_ok_statuspywrap_tensorflow.TF_GetCode(status))tensorflow.python.framework.errors.InternalError: Could not start gRPC server
当我尝试官方分布式教程时,遇到了类似的错误。
编辑: 我在另一台安装了相同软件包的机器上尝试,结果得到了以下错误日志:
E0629 11:17:44.500224628 18393 tcp_server_posix.c:284] bind addr=[::]:2222: Address already in useE0629 11:17:44.500268362 18393 server_chttp2.c:119] No address added out of total 1 resolvedSegmentation fault (core dumped)
问题可能出在哪里?
回答:
问题很可能是你对两个工作节点使用了相同的端口号(2222)。每个端口号在任何给定主机上只能被一个进程使用。这就是“bind addr=[::]:2222: Address already in use”错误的含义。
我猜测你的集群规格中可能有两次“localhost:2222”,或者你为两个任务指定了相同的task_index。
希望这对你有帮助!