我们正在为Docker Volume Plugin运行一个容器化的扭曲应用程序。
容器在我们客户的一个生产环境中长期运行后,抛出了此异常
2019-09-17 10:40:16,178 [INFO] hpedockerplugin.volume_manager [140667061111528] PoolThread-twisted.internet.reactor-1 Initializing node_mount_info... adding first mount ID 4adcf208-d86f-11e9-80bf-a81e84a50362
2019-09-17 10:40:16,179 [DEBUG] os_brick.utils [140667061111528] PoolThread-twisted.internet.reactor-1 ==> get_connector_properties: call "{'root_helper': 'sudo', 'my_ip': '10.49.7.55', 'multipath': True, 'enforce_multipath': True, 'host': None, 'execute': None}"
2019-09-17 10:40:16,180 [INFO] oslo.privsep.daemon [140667061111528] PoolThread-twisted.internet.reactor-1 Running privsep helper: ['sudo', 'privsep-helper', '--config-file', '/etc/hpedockerplugin/hpe.conf', '--privsep_context', 'os_brick.privileged.default', '--privsep_sock_path', '/tmp/tmpqqmjqx5t/privsep.sock']
2019-09-17 10:40:16,378 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: Traceback (most recent call last):
2019-09-17 10:40:16,379 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: File "/usr/bin/privsep-helper", line 6, in <module>
2019-09-17 10:40:16,379 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: from pkg_resources import load_entry_point
2019-09-17 10:40:16,379 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 77, in <module>
2019-09-17 10:40:16,379 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: __import__('pkg_resources.extern.packaging.requirements')
2019-09-17 10:40:16,380 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: File "/usr/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
2019-09-17 10:40:16,380 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
2019-09-17 10:40:16,380 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: File "/usr/lib/python3.6/site-packages/pkg_resources/extern/__init__.py", line 61, in load_module
2019-09-17 10:40:16,380 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: "distribution.".format(**locals())
2019-09-17 10:40:16,380 [WARNING] oslo.privsep.daemon [140667071171304] fd_logger privsep log: ImportError: The 'pyparsing' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
2019-09-17 10:40:16,386 [CRITICAL] oslo.privsep.daemon [140667061111528] PoolThread-twisted.internet.reactor-1 privsep helper command exited non-zero (1)
2019-09-17 10:40:16,387 [DEBUG] os_brick.utils [140667061111528] PoolThread-twisted.internet.reactor-1 <== get_connector_properties: exception (207ms) FailedToDropPrivileges('privsep helper command exited non-zero (1)',)
2019-09-17 10:40:16,387 [DEBUG] hpedockerplugin.etcdutil [140667061111528] PoolThread-twisted.internet.reactor-1 Try unlocking name {volname}
我们怀疑这可能是由容器映像中的某些文件损坏引起的。.我们要求客户从容器中获取整个/usr/lib/python3.6/site-packages,并在运行时如下所示的实验室设置,我们奇怪地发现它能够加载“ pyparsing”模块。
root@cssos39-master:/home/docker/check_files# mv site-packages.nw/ site-packages
root@cssos39-master:/home/docker/check_files# echo $PYTHONPATH
/home/docker/check_files/site-packages
root@cssos39-master:/home/docker/check_files# python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> p='pkg_resources._vendor.pyparsing'
>>> __import__(p)
<module 'pkg_resources' from '/home/docker/check_files/site-packages/pkg_resources/__init__.pyc'>
>>> quit()
在客户的生产包装盒上,相同的实验导致pyparsing软件包的ImportError。 我们的模块构建中包含的pyparsing版本是2.2.0。
我们怀疑setuptools的更高版本(例如41.0.0),我们对其进行了降级,但是再次遇到问题,我们在容器的docker日志中看到了相同的堆栈。
报告的类似问题是:https://github.com/pyinstaller/pyinstaller/issues/1773
为什么会发生这种情况?