Crash with "Assertion failed: (semaphore_info..."
Posted: 2010-03-15T06:34:23-07:00
Hello,
use Magick++ in 10 threads
And Magic++ crash with message in stderr " Assertion failed: (semaphore_info != (SemaphoreInfo *) NULL), function LockSemaphoreInfo, file magick/semaphore.c, line 288"
Gdb bugtrace:
compile Magick++ with option "OpenMP"
What should I do? How to solve this problem?
use Magick++ in 10 threads
Code: Select all
Magick::Image master;
try
{
master.read(path_source + image_filename);
float ratio = (float)master.baseColumns()/master.baseRows();
if(ratio >= 1.19 && ratio <= 1.46)
{
//nothing
}
else
if(ratio > 1.46 && ratio < 1.6)
{
master.crop(Magick::Geometry((int)master.baseColumns()*0.9, master.baseRows(), (int)master.baseColumns()*0.05, 0));
LOG::log_file->WriteLog(LOG::INFO, "%s", ("Image " + image_filename + " cropped").c_str());
}
else
if(ratio > 1.07 && ratio < 1.19)
{
master.crop(Magick::Geometry(master.baseColumns(), (int)master.baseRows()*0.9, 0, (int)master.baseRows()*0.05));
}
else
{
return 1;
}
for(uint i = 0; i < m_config.img_size.size(); i++)
{
Magick::Image image_tmp = master;
image_tmp.resize(m_config.img_size[i].size);
image_tmp.magick("JPEG");
std::string path_res = m_config.Media_storage;
path_res += m_config.img_size[i].name + "/" + image_filename.substr(0,1) + "/" + image_filename.substr(1,2) + "/";
if (! boost::filesystem::exists(path_res))
{
boost::filesystem::create_directories(path_res);
}
image_tmp.write(path_res + image_filename + ".jpg");
}
}
catch( Magick::Exception &error )
{
LOG::log_file->WriteLog(LOG::ERROR, error.what());
return 1;
}
catch( std::exception &error)
{
LOG::log_file->WriteLog(LOG::ERROR, error.what());
return 1;
}
Gdb bugtrace:
Code: Select all
(gdb) bt
#0 0x0000000802a12a9c in thr_kill () from /lib/libc.so.7
#1 0x0000000802aa1ffb in abort () from /lib/libc.so.7
#2 0x0000000802a89fc5 in __assert () from /lib/libc.so.7
#3 0x000000080185a56d in LockSemaphoreInfo () from /usr/local/lib/libMagickCore.so.2
#4 0x00000008017e5650 in DestroyExceptionInfo () from /usr/local/lib/libMagickCore.so.2
#5 0x0000000801801c5a in DestroyImage () from /usr/local/lib/libMagickCore.so.2
#6 0x000000080180c658 in DestroyImageList () from /usr/local/lib/libMagickCore.so.2
#7 0x0000000801e50035 in Magick::ImageRef::~ImageRef () from /usr/local/lib/libMagick++.so.2
#8 0x0000000801e495a9 in Magick::Image::~Image () from /usr/local/lib/libMagick++.so.2
#9 0x0000000000423012 in UpdaterSlave::ResizeImage (this=0x806e17000, image_filename=Variable "image_filename" is not available.
) at HarvesterSlave.cpp:944
#10 0x0000000000424f7b in UpdaterSlave::GetPropPhoto (this=0x806e17000, hex_name=@0x7fffff9fdd30, html=Variable "html" is not available.
) at HarvesterSlave.cpp:1623
#11 0x00000000004323d6 in UpdaterSlave::harvest_thread (US=Variable "US" is not available.
) at HarvesterSlave.cpp:1113
#12 0x00000008014554d1 in pthread_getprio () from /lib/libthr.so.3
#13 0x0000000000000000 in ?? ()
Cannot access memory at address 0x7fffff9fe000
What should I do? How to solve this problem?