Deadlock in ReadOnePNGImage
Posted: 2010-08-19T17:11:25-07:00
Here is the version of the ImageMagick used:
> identify -version
Version: ImageMagick 6.5.3-1 2009-11-23 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Magick++ is used in a multi-threaded C application on Solaris 10. Magick++ seems to get into a deadlock situation in ReadOnePNGImage.
pstack of the process shows around 8 threads in that state. Here are some of the callstacks:
----------------- lwp# 11 / thread# 11 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
----------------- lwp# 12 / thread# 12 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
----------------- lwp# 13 / thread# 13 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
.....
Unfortunately, I don't have the images that caused this problem.
Have you ever seen this problem? From the stacks, do you have insights of what could cause this problem?
Your help is highly appreciated.
Here is how Magick++ is used:
...
> identify -version
Version: ImageMagick 6.5.3-1 2009-11-23 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Magick++ is used in a multi-threaded C application on Solaris 10. Magick++ seems to get into a deadlock situation in ReadOnePNGImage.
pstack of the process shows around 8 threads in that state. Here are some of the callstacks:
----------------- lwp# 11 / thread# 11 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
----------------- lwp# 12 / thread# 12 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
----------------- lwp# 13 / thread# 13 --------------------
fffffd7ffcd27177 lwp_park (0, 0, 0)
fffffd7ffcd1fb88 mutex_lock_impl () + e8
fffffd7ffcd1fc7b mutex_lock () + b
fffffd7ffd629099 LockSemaphoreInfo () + 69
fffffd7ffd759434 ReadOnePNGImage () + 94
fffffd7ffd75c549 ReadPNGImage () + 1d9
fffffd7ffd4b02ce ReadImage () + 31e
fffffd7ffd46c708 BlobToImage () + 228
fffffd7ffd9b4e0f __1cGMagickFImageEread6Mrkn0AEBlob__v_ () + 4f
fffffd7ffefe2cf2 __1cOImageOptimizerIoptimize6MpviiiiipcipF1pCLpL_LpF1pkCL_L_i_ () + 142
fffffd7ffe74824d bmi_doFinal () + 4d
fffffd7ffeae376a opt_final_func () + 92
fffffd7ffeb2b8c6 worker_thread_fsm () + 3ae
fffffd7ffcd26ecb _thr_setup () + 5b
fffffd7ffcd27100 _lwp_start ()
.....
Unfortunately, I don't have the images that caused this problem.
Have you ever seen this problem? From the stacks, do you have insights of what could cause this problem?
Your help is highly appreciated.
Here is how Magick++ is used:
...
Code: Select all
try
{
Blob blob(buf, image_size);
Blob output_blob;
Image image;
image.read(blob);
if (outputFormat != NULL)
{
image.magick(outputFormat);
}
if (xSize != 0)
{
Geometry newDims(xSize, ySize);
if (ignoreAspectRatio)
{
newDims.aspect(true);
}
image.resize(newDims);
}
image.write(&output_blob);
output_buf = output_blob.data();
output_length = output_blob.length();
...
}
catch { ...}