python
python copied to clipboard
"debug build" for at least one image
Recently we had a C extension for python failing in production in an environment that we do not own ourselves. The data in that environment was causing the issues. Because for that reason, it was complicated to reproduce it in different environments, we looked into running a debug version of python in that environment to understand where it was crashing, but that turned out quite complicated to do.
In the end I managed to home in on the data issues, set up data locally to reproduce it and build a debug version of the slim-bullseye image that I could use as a source for our application image. This allowed us to dump a core and investigate the back traces.
Would it be helpful to have at least one image that contains a debug build of python in this stack, so that it's easier for developers to switch to that image and do this analysis?
An image that adds these lines to .,/configure
--with-pydebug \ CFLAGS="-g -O0" \
and sets LDFLAGS="" instead of LDFLAGS="-Wl,--strip-all"; \ ,
installs gdb and gdb extensions (# enable GDB to load debugging data: https://github.com/docker-library/python/pull/701)
If that's not a good idea, could you let me know what you'd recommend otherwise as a better process?
Sorry for the delay. :bow:
The matrix of supported variants for this image is already pretty large (multiplied by base image combinations and supported architectures), and compiling Python from source is kind of heavy, so we're not super comfortable supporting even more variance. :sweat_smile:
It wasn't too hard to add the gtoonsta changes to a matrix of build and push it to DockerHub.
I've made this fork https://github.com/Luiz-Monad/docker-python/ with the changes https://github.com/Luiz-Monad/docker-python/commit/fe752b6410d1defc6e42400120f2605bf9d6f3e7
And this is the reason it wasn't a good idea. ( https://github.com/Luiz-Monad/docker-python/commit/af7b61350c87050f5a79627f70a18b881eeaf5af ) . Alpine didn't have the package for systemtap (aka dtrace), oh well.
An idea would be for the debug image to be only available for the latest platforms on x64 only, that would cut the amount of extra images. Also, when you have a problem its a good thing to just update the image to see if it solves itself before attempting to actually debug inside the container, or just fork the repository and add specifically the images you need.
You could at least have the option in the script for the debug so we can do that ourselves if we needed, but that would also be extra thing to maintain.