Greetings!
I am having an issue when using the package sorl.thumbnail on a Django project. That package produces thumbnails from images using system installed programs (called engines.)
When sorl.thumbnail makes a Popen call here:
https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/engines/convert_engine.py#L57
The arguments that are received in your patched Popen are not being interpreted correctly. This is the suspect of the problem:
|
def sentry_patched_popen_init(self, *a, **kw): |
Arguments are handled in such a way that the original popen crashes when trying to access args[0], as the args parameter is interpreted (or actually becomes) an empty list.
In my opinion, the problem arises because in sorl.thumbnail the arguments to Popen are passed to a map function first, so that a map object is what gets passed as arguments. I am not sure what's the effect of a map object being received in your *a of the patched Popen.
Here's the relevant part of the traceback I am getting:
File "/mnt/d/Proyectos/ginseng/.venv/lib/python3.6/site-packages/sorl/thumbnail/base.py", line 131, in get_thumbnail
thumbnail)
File "/mnt/d/Proyectos/ginseng/.venv/lib/python3.6/site-packages/sorl/thumbnail/base.py", line 164, in _create_thumbnail
default.engine.write(image, options, thumbnail)
File "/mnt/d/Proyectos/ginseng/.venv/lib/python3.6/site-packages/sorl/thumbnail/engines/convert_engine.py", line 57, in write
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/mnt/d/Proyectos/ginseng/.venv/lib/python3.6/site-packages/sentry_sdk/integrations/stdlib.py", line 165, in sentry_patched_popen_init
return old_popen_init(self, *a, **kw)
File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1248, in _execute_child
executable = args[0]
IndexError: list index out of range
If I remove the Sentry integration altogether from the Django project, sorl.thumbnail is able to effectively call Popen with the "mapped" arguments, and everything works.
Thanks in advance!
Greetings!
I am having an issue when using the package
sorl.thumbnailon a Django project. That package produces thumbnails from images using system installed programs (called engines.)When
sorl.thumbnailmakes aPopencall here:https://github.com/jazzband/sorl-thumbnail/blob/22ccd9781462a820f963f57018ad3dcef85053ed/sorl/thumbnail/engines/convert_engine.py#L57
The arguments that are received in your patched
Popenare not being interpreted correctly. This is the suspect of the problem:sentry-python/sentry_sdk/integrations/stdlib.py
Line 143 in 2c0a2ea
Arguments are handled in such a way that the original
popencrashes when trying to accessargs[0], as theargsparameter is interpreted (or actually becomes) an empty list.In my opinion, the problem arises because in
sorl.thumbnailthe arguments toPopenare passed to amapfunction first, so that amapobject is what gets passed as arguments. I am not sure what's the effect of amapobject being received in your*aof the patchedPopen.Here's the relevant part of the traceback I am getting:
If I remove the Sentry integration altogether from the Django project,
sorl.thumbnailis able to effectively callPopenwith the "mapped" arguments, and everything works.Thanks in advance!