[Interest] crash saving image from multiple threads

Manner RĂ³bert rmanni at gmail.com
Mon May 9 10:14:34 CEST 2016


Hi,

we are porting a library from Qt4 -> Qt5 and we have an interesting crash
which seems to occur if our code does image saving on multiple threads. It
seems not crash if run on one thread, and also seems not crash if the first
call to the save image is done before starting the threads.

We see the backtrace below. We call the image save (to png) on separate
images, each instance is only used by one thread. Still, it seems it is
doing some library loading (loading the png handler plugin?) which is not
thread safe(?).

Does anyone have a clue what happens here? Did you observe such? Do you
have an idea what we might be doing wrong?

#0 0x00007ffff620f418 in __GI_raise (sig=sig at entry=6) at
../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff621101a in __GI_abort () at abort.c:89
#2 0x00007ffff625172a in __libc_message (do_abort=2,
fmt=fmt at entry=0x7ffff636a6b0
"*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
#3 0x00007ffff625a679 in malloc_printerr (ar_ptr=0x7fffc4000020,
ptr=<optimized out>,
str=0x7ffff6367472 "corrupted double-linked list", action=3) at
malloc.c:5007
#4 _int_free (av=0x7fffc4000020, p=<optimized out>, have_lock=0) at
malloc.c:4015
#5 0x00007ffff625dabc in __GI___libc_free (mem=<optimized out>) at
malloc.c:2969
#6 0x00007ffff6c6f7c8 in QTypedArrayData<unsigned short>::deallocate
(data=<optimized out>)
at ../../include/QtCore/../../src/corelib/tools/qarraydata.h:222
#7 QString::operator= (this=this at entry=0x7fffd001e1a0, other=...) at
tools/qstring.cpp:1741
#8 0x00007ffff6dbc86a in QLibraryPrivate::load_sys (this=0x7fffd001e190) at
plugin/qlibrary_unix.cpp:259
#9 0x00007ffff6db5e9d in QLibraryPrivate::load (this=0x7fffd001e190) at
plugin/qlibrary.cpp:534
#10 QLibraryPrivate::loadPlugin (this=this at entry=0x7fffd001e190) at
plugin/qlibrary.cpp:582
#11 0x00007ffff6dad61b in QFactoryLoader::instance (
this=this at entry=0x7ffff7554280
<_ZZN12_GLOBAL__N_112Q_QGS_loader13innerFunctionEvE6holder>,
index=index at entry=3)
at plugin/qfactoryloader.cpp:257
#12 0x00007ffff71656d2 in createWriteHandlerHelper (device=0x7fffc8008d40,
format=...) at image/qimagewriter.cpp:217
#13 0x00007ffff716612c in QImageWriterPrivate::canWriteHelper
(this=0x7fffc80088f0) at image/qimagewriter.cpp:301
#14 QImageWriter::canWrite (this=<optimized out>) at
image/qimagewriter.cpp:718
#15 0x00007ffff7166195 in QImageWriter::write (this=this at entry=0x7fffde812d20,
image=...) at image/qimagewriter.cpp:740
#16 0x00007ffff7140db6 in QImageData::doImageIO (this=<optimized out>,
image=image at entry=0x7fffde813030,
writer=writer at entry=0x7fffde812d20, quality=quality at entry=-1) at
image/qimage.cpp:3343
#17 0x00007ffff7140ee3 in QImage::save (this=0x7fffde813030, fileName=...,
format=<optimized out>, quality=-1)
at image/qimage.cpp:3312
#18 0x00007ffff7a3c8d0 in
Applications::Indexer::SaveImageListener::save_image_to_file
(this=0x7fffc8003310, image=...,
file_name=...) at ../../../../src/lib/core/listeners/saveimagelistener.cc:53

Thanks for any help in advance,

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160509/1de63714/attachment.html>


More information about the Interest mailing list