Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault (core dumped) when pip installing inside nested docker container #485

Closed
iisojunn opened this issue Feb 23, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@iisojunn
Copy link

Segmentation fault (core dumped) occurs when executing python -m pip install <package> inside python:3.8.0-slim container running inside nestybox/alpine-docker which utilizes sysbox-runc. The issue seems to be related how pip uninstalls packages. The fault only occurs inside nested (second level) docker container, not on first level docker container (sysbox-runc in use in both cases). It is unclear for me if root cause for the issue exists in sysbox-runc or pip.

The issue was found during docker-in-docker image build CI job. It does not matter if the command python -m pip install <package> is executed inside the container manually or when building image and running Dockerfile command RUN python -m pip install <package>.

The issue is not limited on python:3.8.0-slim image, also newer python versions and not slim images cause same symptoms. Image python:3.7.0-slim did not seem to have this problem.

In addition to Segmentation fault (error code 139), there has also been been Bus Error (error code 135) visible, but just couple times.

The segmentation fault does not occur every time. With different pip packages pip install sometimes succeeds and sometimes not. However, there are also consistent ways for producing Segmentation fault every time.

When executing different pip commands (varying package etc.), the segmentation fault occurs at different places in code. This means that tracebacks/backtraces are not similar in every case. Some occurred segfault locations are: visit_decref, pymalloc_alloc, _PyObject_IS_GC.

Workaround

The segmentation fault does seem to occur when pip installs package which has already different version installed. Somehow it might be related to pip uninstall logic with folder stashing (setuptools -> ~etuptools) and rollback possibility. It seems that one can avoid segmentation fault if pip packages are installed with --ignore-installed. (Also --user flag and --target <empty-folder> seem to work, probably because in the target folder there is no packages to be uninstalled.)

python -m pip install --ignore-installed setuptools

Generating the fault

Starting first level docker container on host.

docker run -it --runtime=sysbox-runc nestybox/alpine-docker sh -c "dockerd >/dev/null 2>&1 & sh"

Consistent Segmentation fault due to python -m pip install --upgrade setuptools which is executed inside second level docker container.

# Execute inside nestybox/alpine-docker
docker run python:3.9 bash -c "python -m pip install --upgrade setuptools && echo done"

Same as earlier, but with gdb debugger attached and with python debugging symbols (python line numbers seemed to be off for some reason).

# Execute inside nestybox/alpine-docker
docker run -it python:3.9 bash -c "apt update && apt install gdb python3.9-dbg -y && echo \"source /usr/share/gdb/auto-load/usr/bin/python3.9-gdb.py\" >> /root/.gdbinit && gdb -ex=r --args python -m pip install --upgrade setuptools && bash"

Segmentation fault every now and then caused by python -m pip uninstall setuptools -y

# Execute inside nestybox/alpine-docker
docker run -it python:3.9 bash -c "apt update && apt install gdb python3.9-dbg -y && echo \"source /usr/share/gdb/auto-load/usr/bin/python3.9-gdb.py\" >> /root/.gdbinit && gdb -ex=r --args python -m pip uninstall setuptools -y && bash"

Debug logs

Debug logs
$ docker run -it --runtime=sysbox-runc nestybox/alpine-docker sh -c "dockerd >/dev/null 2>&1 & sh"
/ # docker run -it python:3.9 bash -c "apt update >/dev/null && apt install gdb python3.9-dbg -y >/dev/null && echo \"source /usr/share/gdb/auto-load/usr/bin/python3.9-gdb.py\" >> /root/.gdbinit && gdb -ex=r --args python -m pip install --verbose --upgrade setuptools && bash"
Unable to find image 'python:3.9' locally
3.9: Pulling from library/python
0c6b8ff8c37e: Pull complete 
412caad352a3: Pull complete 
e6d3e61f7a50: Pull complete 
461bb1d8c517: Pull complete 
808edda3c2e8: Pull complete 
724cfd2dc19b: Pull complete 
3f17120b662f: Pull complete 
daafe55ab30d: Pull complete 
9bfe4dd1ecef: Pull complete 
Digest: sha256:4df8cb63103761b6bf1fc5c37a329d51d385faa380c969b040834ffe7b37b646
Status: Downloaded newer image for python:3.9

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.


WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

debconf: delaying package configuration, since apt-utils is not installed
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
Starting program: /usr/local/bin/python -m pip install --verbose --upgrade setuptools
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Using pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
[Detaching after fork from child process 822]
[Detaching after fork from child process 823]
Requirement already satisfied: setuptools in /usr/local/lib/python3.9/site-packages (58.1.0)
Collecting setuptools
  Downloading setuptools-60.9.3-py3-none-any.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 5.0 MB/s 
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 58.1.0
    Uninstalling setuptools-58.1.0:
      Removing file or directory /usr/local/lib/python3.9/site-packages/_distutils_hack/
      Removing file or directory /usr/local/lib/python3.9/site-packages/distutils-precedence.pth
      Removing file or directory /usr/local/lib/python3.9/site-packages/pkg_resources/
      Removing file or directory /usr/local/lib/python3.9/site-packages/setuptools-58.1.0.dist-info/
      Removing file or directory /usr/local/lib/python3.9/site-packages/setuptools/
      Successfully uninstalled setuptools-58.1.0

Program received signal SIGSEGV, Segmentation fault.
pymalloc_alloc (ctx=0x0, nbytes=256) at Objects/obmalloc.c:1621
1621    Objects/obmalloc.c: No such file or directory.
(gdb) py-bt
Traceback (most recent call first):
  <built-in method compile of module object at remote 0x7f4dae649860>
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1169, in source_to_code
  File "/usr/local/lib/python3.9/py_compile.py", line 656, in compile
  File "/usr/local/lib/python3.9/compileall.py", line 1006, in compile_file
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 2207, in _install_wheel
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py", line 1050, in install_wheel
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 1782, in install
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/req/__init__.py", line 841, in install_given_reqs
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 5254, in run
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper
    return func(self, options, args)
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 1197, in _main
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 98, in main
    return self._main(args)
  File "/usr/local/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.9/site-packages/pip/__main__.py", line 287, in <module>
  <built-in method exec of module object at remote 0x7f4dae649860>
  File "/usr/local/lib/python3.9/runpy.py", line 343, in _run_code
  File "/usr/local/lib/python3.9/runpy.py", line 453, in _run_module_as_main
(gdb) (gdb) bt 50
#0  pymalloc_alloc (ctx=0x0, nbytes=256) at Objects/obmalloc.c:1621
#1  _PyObject_Malloc (nbytes=256, ctx=0x0) at Objects/obmalloc.c:1640
#2  PyMem_Malloc (size=256) at Objects/obmalloc.c:605
#3  0x00007f4daebb3d66 in set_table_resize (so=0x7f4dac463740, minused=<optimized out>) at Objects/setobject.c:260
#4  0x00007f4daebb3777 in set_merge (otherset={'req', 'self', 'extra_evals', 'extras', '__class__'}, so=0x7f4dac463740) at Objects/setobject.c:564
#5  set_update_internal (so=0x7f4dac463740, other={'req', 'self', 'extra_evals', 'extras', '__class__'}) at Objects/setobject.c:873
#6  0x00007f4daebb2967 in make_new_set (iterable={'req', 'self', 'extra_evals', 'extras', '__class__'}, type=0x7f4daeda2ca0 <PySet_Type>) at Objects/setobject.c:957
#7  PySet_New (iterable=iterable@entry={'req', 'self', 'extra_evals', 'extras', '__class__'}) at Objects/setobject.c:2242
#8  0x00007f4daebfc3d3 in analyze_child_block (child_free=<optimized out>, global=<optimized out>, free=<optimized out>, bound={'req', 'self', 'extra_evals', 'extras', '__class__'}, entry=0x7f4dac55fc00) at Python/symtable.c:899
#9  analyze_block (ste=0x7f4dac55fb90, bound={'__class__'}, free=set(), global=<optimized out>) at Python/symtable.c:845
#10 0x00007f4daebfc41c in analyze_child_block (child_free=<optimized out>, global=<optimized out>, free=<optimized out>, bound={'__class__'}, entry=0x7f4dac55fb90) at Python/symtable.c:909
#11 analyze_block (ste=0x7f4dac55fb20, bound=set(), free=set(), global=<optimized out>) at Python/symtable.c:845
#12 0x00007f4daebfc41c in analyze_child_block (child_free=<optimized out>, global=<optimized out>, free=<optimized out>, bound=set(), entry=0x7f4dac55fb20) at Python/symtable.c:909
#13 analyze_block (ste=0x7f4dac443b20, bound=0x0, free=set(), global=<optimized out>) at Python/symtable.c:845
#14 0x00007f4daec6783c in symtable_analyze (st=0x7f4dac445760) at Python/symtable.c:940
#15 PySymtable_BuildObject (mod=mod@entry=0x562e2fd5c4f8, filename=filename@entry='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', future=<optimized out>) at Python/symtable.c:338
#16 0x00007f4daec56f23 in PyAST_CompileObject (mod=0x562e2fd5c4f8, filename=filename@entry='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', flags=flags@entry=0x7ffe90999a68, optimize=optimize@entry=-1, 
    arena=arena@entry=0x7f4dacb0d710) at Python/compile.c:363
#17 0x00007f4daec665ac in Py_CompileStringObject (
    str=0x562e2f922f40 "\"\"\"\nPackage resource API\n", '-' <repeats 20 times>, "\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have thei"..., filename=filename@entry='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', start=257, flags=flags@entry=0x7ffe90999a68, optimize=optimize@entry=-1) at Python/pythonrun.c:1316
#18 0x00007f4daec53ff1 in builtin_compile_impl (module=<optimized out>, feature_version=<optimized out>, optimize=-1, dont_inherit=<optimized out>, flags=0, mode=0x7ffe90999a68 "", 
    filename='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', 
    source=b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport functools\nimport pkgutil\nimport operator\nimport platform\nimport collections\nimport plistlib\nimport email.parser\nimport errno\nimport tempfile\nimport textwrap\nimport itertools\nimport inspect\nimport ntpath\nimport posixpath\nimport importlib\nf...(truncated)) at Python/bltinmodule.c:810
#19 builtin_compile (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/clinic/bltinmodule.c.h:274
#20 0x00007f4daebad3a4 in cfunction_vectorcall_FASTCALL_KEYWORDS (func=<built-in method compile of module object at remote 0x7f4dae649860>, args=<optimized out>, nargsf=<optimized out>, kwnames=('dont_inherit', 'optimize'))
    at Objects/methodobject.c:446
#21 0x00007f4daeb8bb82 in PyVectorcall_Call (callable=<built-in method compile of module object at remote 0x7f4dae649860>, tuple=<optimized out>, kwargs=<optimized out>) at Objects/call.c:243
#22 0x00007f4daebe63e0 in do_call_core (kwdict={'dont_inherit': True, 'optimize': -1}, 
--Type <RET> for more, q to quit, c to continue without paging--c
    callargs=(b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport functools\nimport pkgutil\nimport operator\nimport platform\nimport collections\nimport plistlib\nimport email.parser\nimport errno\nimport tempfile\nimport textwrap\nimport itertools\nimport inspect\nimport ntpath\nimport posixpath\nimport importlib\n...(truncated), func=<built-in method compile of module object at remote 0x7f4dae649860>, tstate=<optimized out>) at Python/ceval.c:5097
#23 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3582
#24 0x00007f4daebe00d9 in _PyEval_EvalFrame (throwflag=0, f=Frame 0x7f4dacb34c80, for file <frozen importlib._bootstrap>, line 228, in _call_with_frames_removed (f=<built-in method compile of module object at remote 0x7f4dae649860>, args=(b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport functools\nimport pkgutil\nimport operator\nimport platform\nimport collec...(truncated), tstate=0x562e2ede6a90) at ./Include/internal/pycore_ceval.h:40
#25 _PyEval_EvalCode (tstate=tstate@entry=0x562e2ede6a90, _co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7f4dae5bc3b0, argcount=argcount@entry=4, kwnames=0x7f4dae678e18, kwargs=0x7f4dae5bc3d0, kwcount=<optimized out>, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='_call_with_frames_removed', qualname='_call_with_frames_removed') at Python/ceval.c:4329
#26 0x00007f4daeb8ac8c in _PyFunction_Vectorcall (func=<optimized out>, stack=0x7f4dae5bc3b0, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:396
#27 0x00007f4daebe1d92 in _PyObject_VectorcallTstate (kwnames=('dont_inherit', 'optimize'), nargsf=<optimized out>, args=0x7f4dae5bc3b0, callable=<function at remote 0x7f4dae6653a0>, tstate=0x562e2ede6a90) at ./Include/cpython/abstract.h:118
#28 PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=0x7f4dae5bc3b0, callable=<function at remote 0x7f4dae6653a0>) at ./Include/cpython/abstract.h:127
#29 call_function (kwnames=<optimized out>, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:5077
#30 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3537
#31 0x00007f4daebe0678 in _PyEval_EvalFrame (throwflag=0, f=Frame 0x7f4dae5bc220, for file <frozen importlib._bootstrap_external>, line 1169, in source_to_code (self=<SourceFileLoader(name='<py_compile>', path='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py') at remote 0x7f4dac54e790>, data=b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport fun...(truncated), tstate=0x562e2ede6a90) at ./Include/internal/pycore_ceval.h:40
#32 _PyEval_EvalCode (tstate=tstate@entry=0x562e2ede6a90, _co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x562e2f8ed140, argcount=argcount@entry=3, kwnames=0x7f4dad417a48, kwargs=0x562e2f8ed158, kwcount=<optimized out>, kwstep=1, defs=0x0, defcount=0, kwdefs={'_optimize': -1}, closure=0x0, name='source_to_code', qualname='SourceLoader.source_to_code') at Python/ceval.c:4329
#33 0x00007f4daeb8ac8c in _PyFunction_Vectorcall (func=<optimized out>, stack=0x562e2f8ed140, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:396
#34 0x00007f4daeb8c758 in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=0x562e2f8ed140, callable=<function at remote 0x7f4dae6258b0>, tstate=0x562e2ede6a90) at ./Include/cpython/abstract.h:118
#35 method_vectorcall (method=<optimized out>, args=0x562e2f8ed148, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/classobject.c:53
#36 0x00007f4daebe1d92 in _PyObject_VectorcallTstate (kwnames=('_optimize',), nargsf=<optimized out>, args=0x562e2f8ed148, callable=<method at remote 0x7f4dac53e4c0>, tstate=0x562e2ede6a90) at ./Include/cpython/abstract.h:118
#37 PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=0x562e2f8ed148, callable=<method at remote 0x7f4dac53e4c0>) at ./Include/cpython/abstract.h:127
#38 call_function (kwnames=<optimized out>, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:5077
#39 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3537
#40 0x00007f4daebe00d9 in _PyEval_EvalFrame (throwflag=0, f=Frame 0x562e2f8ecf40, for file /usr/local/lib/python3.9/py_compile.py, line 656, in compile (file='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', cfile='/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc', dfile=None, doraise=True, optimize=-1, invalidation_mode=<PycInvalidationMode(_value_=1, _name_='TIMESTAMP', __objclass__=<EnumMeta(_generate_next_value_=<function at remote 0x7f4dae3a2e50>, __module__='py_compile', __doc__='An enumeration.', _member_names_=['TIMESTAMP', 'CHECKED_HASH', 'UNCHECKED_HASH'], _member_map_={'TIMESTAMP': <...>, 'CHECKED_HASH': <PycInvalidationMode(_value_=2, _name_='CHECKED_HASH', __objclass__=<...>) at remote 0x7f4dad5eb5b0>, 'UNCHECKED_HASH': <PycInvalidationMode(_value_=3, _name_='UNCHECKED_HASH', __objclass__=<...>) at remote 0x7f4dad5bce80>}, _member_type_=<type at remote 0x7f4daeda67e0>, _value2member_map_={1: <...>, 2: <...>, 3: <...>}, TIMESTAMP=<...>, CHECKED_HASH=<...>, UNCHECKED_HASH=<...>, __new__=<function at ...(truncated), tstate=0x562e2ede6a90) at ./Include/internal/pycore_ceval.h:40
#41 _PyEval_EvalCode (tstate=tstate@entry=0x562e2ede6a90, _co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x562e2f8c6708, argcount=argcount@entry=4, kwnames=0x7f4dacdabf98, kwargs=0x562e2f8c6728, kwcount=<optimized out>, kwstep=1, defs=0x7f4dace2edd8, defcount=6, kwdefs=0x0, closure=0x0, name='compile', qualname='compile') at Python/ceval.c:4329
#42 0x00007f4daeb8ac8c in _PyFunction_Vectorcall (func=<optimized out>, stack=0x562e2f8c6708, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:396
#43 0x00007f4daebe1d92 in _PyObject_VectorcallTstate (kwnames=('optimize', 'invalidation_mode'), nargsf=<optimized out>, args=0x562e2f8c6708, callable=<function at remote 0x7f4dace0bf70>, tstate=0x562e2ede6a90) at ./Include/cpython/abstract.h:118
#44 PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=0x562e2f8c6708, callable=<function at remote 0x7f4dace0bf70>) at ./Include/cpython/abstract.h:127
#45 call_function (kwnames=<optimized out>, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=<optimized out>) at Python/ceval.c:5077
#46 _PyEval_EvalFrameDefault (tstate=<optimized out>, f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3537
#47 0x00007f4daebe0678 in _PyEval_EvalFrame (throwflag=0, f=Frame 0x562e2f8c6460, for file /usr/local/lib/python3.9/compileall.py, line 1006, in compile_file (fullname='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', ddir=None, force=True, rx=None, quiet=True, legacy=False, optimize=[-1], invalidation_mode=None, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False, success=True, name='__init__.py', dfile=None, opt_cfiles={-1: '/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc'}, opt_level=-1, cfile='/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc', head='__init__', tail='.py', index=0), tstate=0x562e2ede6a90) at ./Include/internal/pycore_ceval.h:40
#48 _PyEval_EvalCode (tstate=tstate@entry=0x562e2ede6a90, _co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x562e2f8d8230, argcount=argcount@entry=1, kwnames=0x7f4dacda9e98, kwargs=0x562e2f8d8238, kwcount=<optimized out>, kwstep=1, defs=0x7f4dace3d418, defcount=7, kwdefs={'stripdir': None, 'prependdir': None, 'limit_sl_dest': None, 'hardlink_dupes': False}, closure=0x0, name='compile_file', qualname='compile_file') at Python/ceval.c:4329
#49 0x00007f4daeb8ac8c in _PyFunction_Vectorcall (func=<optimized out>, stack=0x562e2f8d8230, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:396
(More stack frames follow...)
(gdb) py-up
#23 Frame 0x7f4dacb34c80, for file <frozen importlib._bootstrap>, line 228, in _call_with_frames_removed (f=<built-in method compile of module object at remote 0x7f4dae649860>, args=(b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport functools\nimport pkgutil\nimport operator\nimport platform\nimport collec...(truncated)
(gdb) py-up
#30 Frame 0x7f4dae5bc220, for file <frozen importlib._bootstrap_external>, line 1169, in source_to_code (self=<SourceFileLoader(name='<py_compile>', path='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py') at remote 0x7f4dac54e790>, data=b'"""\nPackage resource API\n--------------------\n\nA resource is a logical file contained within a package, or a logical\nsubdirectory thereof.  The package resource API expects resource names\nto have their path parts separated with ``/``, *not* whatever the local\npath separator is.  Do not use os.path operations to manipulate resource\nnames being passed into the API.\n\nThe package resource API is designed to work with normal filesystem packages,\n.egg files, and unpacked .egg files.  It can also work in a limited way with\n.zip files and with custom PEP 302 loaders that support the ``get_data()``\nmethod.\n"""\n\nimport sys\nimport os\nimport io\nimport time\nimport re\nimport types\nimport zipfile\nimport zipimport\nimport warnings\nimport stat\nimport fun...(truncated)
(gdb) py-up
#39 Frame 0x562e2f8ecf40, for file /usr/local/lib/python3.9/py_compile.py, line 656, in compile (file='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', cfile='/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc', dfile=None, doraise=True, optimize=-1, invalidation_mode=<PycInvalidationMode(_value_=1, _name_='TIMESTAMP', __objclass__=<EnumMeta(_generate_next_value_=<function at remote 0x7f4dae3a2e50>, __module__='py_compile', __doc__='An enumeration.', _member_names_=['TIMESTAMP', 'CHECKED_HASH', 'UNCHECKED_HASH'], _member_map_={'TIMESTAMP': <...>, 'CHECKED_HASH': <PycInvalidationMode(_value_=2, _name_='CHECKED_HASH', __objclass__=<...>) at remote 0x7f4dad5eb5b0>, 'UNCHECKED_HASH': <PycInvalidationMode(_value_=3, _name_='UNCHECKED_HASH', __objclass__=<...>) at remote 0x7f4dad5bce80>}, _member_type_=<type at remote 0x7f4daeda67e0>, _value2member_map_={1: <...>, 2: <...>, 3: <...>}, TIMESTAMP=<...>, CHECKED_HASH=<...>, UNCHECKED_HASH=<...>, __new__=<function at ...(truncated)
(gdb) py-up
#46 Frame 0x562e2f8c6460, for file /usr/local/lib/python3.9/compileall.py, line 1006, in compile_file (fullname='/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py', ddir=None, force=True, rx=None, quiet=True, legacy=False, optimize=[-1], invalidation_mode=None, stripdir=None, prependdir=None, limit_sl_dest=None, hardlink_dupes=False, success=True, name='__init__.py', dfile=None, opt_cfiles={-1: '/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc'}, opt_level=-1, cfile='/usr/local/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc', head='__init__', tail='.py', index=0)
(gdb) py-up
#53 Frame 0x562e2f8d7e90, for file /usr/local/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py, line 2207, in _install_wheel (name='setuptools', scheme=<Scheme at remote 0x7f4dac59f4a0>, pycompile=True, warn_script_location=True, direct_url=None, requested=True, info_dir='setuptools-60.9.3.dist-info', metadata=<Message(policy=<Compat32 at remote 0x7f4dae2da040>, _headers=[('Wheel-Version', '1.0'), ('Generator', 'bdist_wheel (0.37.1)'), ('Root-Is-Purelib', 'true'), ('Tag', 'py3-none-any')], _unixfrom=None, _payload='', _charset=None, preamble=None, epilogue=None, defects=[], _default_type='text/plain') at remote 0x7f4dac535280>, generated=[], record_installed=<function at remote 0x7f4dac804dc0>, all_paths=<function at remote 0x7f4dac804430>, is_dir_path=<function at remote 0x7f4dac804af0>, root_scheme_file_maker=<function at remote 0x7f4dac804c10>, data_scheme_file_maker=<function at remote 0x7f4dac8049d0>, is_data_scheme_path=<function at remote 0x7f4dac804f70>, paths=<generator at remote 0x7...(truncated)
(gdb) py-up

Host computer

$ uname -a
Linux <hostname> 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux
$ apt list sysbox-ce
Listing... Done
sysbox-ce/now 0.4.1-0.debian-bullseye amd64 [installed,local]
$ docker version
Client: Docker Engine - Community
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:43:23 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:30 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
$ cat /etc/docker/daemon.json 
{
    <debug, dns, dns-search and registry-mirror settings>
    "runtimes": {
        "sysbox-runc": {
            "path": "/usr/bin/sysbox-runc"
        }
    }
}
$ sudo modinfo shiftfs
filename:       /lib/modules/5.10.0-9-amd64/updates/dkms/shiftfs.ko
license:        GPL v2
description:    id shifting filesystem
author:         Christian Brauner <christian.brauner@ubuntu.com>
author:         Seth Forshee <seth.forshee@canonical.com>
author:         James Bottomley
alias:          fs-shiftfs
depends:        
retpoline:      Y
name:           shiftfs
vermagic:       5.10.0-9-amd64 SMP mod_unload modversions
@iisojunn
Copy link
Author

I am unable to add "v0.4.1" and "Bug" labels.

@rodnymolina rodnymolina added the bug Something isn't working label Feb 23, 2022
@rodnymolina
Copy link
Member

@iisojunn, thanks for the very detailed description and reproduction steps!

We have fixed a couple of bugs in this space over the last few weeks. I believe that this one in particular addresses the problem that you are referring to. I'm not able to reproduce the problem with our latest code anymore.

These fixes will be included in our next release within a couple of weeks. For now, please build sysbox binaries from scratch and let us know if that fixes the issue. Find the instructions here.

@rodnymolina rodnymolina self-assigned this Feb 24, 2022
@iisojunn
Copy link
Author

Hi, thanks for the fast response!

I just tested with binaries build from the following commit:

de91fb8 (HEAD -> master, origin/master, origin/HEAD) Add syscall xattr tests to syscall test script.

Pip install within nested container seems to work!

I guess, I'll continue with the workaround until the next release is out.

@damienrj
Copy link

damienrj commented Mar 9, 2022

Any updates on when the new release is due to come out?

@rodnymolina
Copy link
Member

@damienrj, we expect the new release to come out by the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants