Re: [osg-users] [osgPlugins] TIFF Plugin not threadsafe?
Hi, I didn't had time for it in the past weeks but we still experiencing crashes when we try to load OpenFlight / Tiff images. Mostly it crashes inside dlopen() !? I'll have to investigate further. ... Thank you! Cheers, Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44684#44684 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] TIFF Plugin not threadsafe?
Hi Christian, Do you come across any discussion online about thread safety of libtiff? Have you got any further in resolving this issue? I have lots of stuff in intray to deal with so can't personally chase up the issue right away so would appreciate if you can make some headway on. Cheers, Robert. On 3 December 2011 15:16, Christian Ehrlicher ch.ehrlic...@gmx.de wrote: Hello, I'm experiencing crashes when I try to read tiff images / textures with osg. When I use other image formats all seems to work fine. Since I'm using a lot of threads I came to the conclusion that there's maybe a threading problem inside ReaderWriterTIFF.cpp. So I wrote a small testcase (see attachment, needs Qt) and valgrind --tool=helgrind gives me thisi answer: Code: ==20491== Possible data race during read of size 4 at 0x128e6270 by thread #4 ==20491== at 0x126E2518: simage_tiff_load(std::istream, int, int, int, unsigned short) (ReaderWriterTIFF.cpp:748) ==20491== by 0x126E3BF4: ReaderWriterTIFF::readImage(std::string const, osgDB::Options const*) const (ReaderWriterTIFF.cpp:793) ==20491== by 0x4EEB3DD: osgDB::Registry::ReadImageFunctor::doRead(osgDB::ReaderWriter) const (Registry.cpp:908) ==20491== by 0x4EE67C8: osgDB::Registry::read(osgDB::Registry::ReadFunctor const) (Registry.cpp:1103) ==20491== by 0x4EE76CA: osgDB::Registry::readImplementation(osgDB::Registry::ReadFunctor const, osgDB::Options::CacheHintOptions) (Registry.cpp:1277) ==20491== by 0x4EE7D44: osgDB::Registry::readImageImplementation(std::string const, osgDB::Options const*) (Registry.cpp:1355) ==20491== by 0x4EDBA30: osgDB::readImageFile(std::string const, osgDB::Options const*) (Registry:231) ==20491== by 0x4019AB: MyThread::run() (in /home/chehrlic/tds/osg-build-desktop-Qt_aus_PATH_Release/osg) ==20491== by 0x68FC024: QThreadPrivate::start(void*) (qthread_unix.cpp:331) ==20491== by 0x4C2A63D: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so) ==20491== by 0x6D1BF04: start_thread (in /lib64/libpthread-2.14.1.so) ==20491== by 0x778153C: clone (in /lib64/libc-2.14.1.so) ==20491== This conflicts with a previous write of size 4 by thread #2 ==20491== at 0x126E21E1: simage_tiff_load(std::istream, int, int, int, unsigned short) (ReaderWriterTIFF.cpp:652) ==20491== by 0x126E3BF4: ReaderWriterTIFF::readImage(std::string const, osgDB::Options const*) const (ReaderWriterTIFF.cpp:793) ==20491== by 0x4EEB3DD: osgDB::Registry::ReadImageFunctor::doRead(osgDB::ReaderWriter) const (Registry.cpp:908) ==20491== by 0x4EE67C8: osgDB::Registry::read(osgDB::Registry::ReadFunctor const) (Registry.cpp:1103) ==20491== by 0x4EE76CA: osgDB::Registry::readImplementation(osgDB::Registry::ReadFunctor const, osgDB::Options::CacheHintOptions) (Registry.cpp:1277) ==20491== by 0x4EE7D44: osgDB::Registry::readImageImplementation(std::string const, osgDB::Options const*) (Registry.cpp:1355) ==20491== by 0x4EDBA30: osgDB::readImageFile(std::string const, osgDB::Options const*) (Registry:231) ==20491== by 0x4019AB: MyThread::run() (in /home/chehrlic/tds/osg-build-desktop-Qt_aus_PATH_Release/osg) ==20491== The related piece of code is Code: currPtr = buffer + (h-1)*w*format; tifferror = ERR_NO_ERROR; // line 526 switch (pack(photometric, config)) And tifferror is a static variable which is accessed without a mutex (which would also be wrong - the variable needs to be in the TLS). Is my observation correct? And If so - can someone fix it for me? ;-) /add Looks like TiffSetError/WarningHandler needs also a mutex (Line 526 + 527) - at least valgrind complains about a problem there too (inside tiff library). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44204#44204 Attachments: http://forum.openscenegraph.org//files/osg_tifftar_197.gz ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] TIFF Plugin not threadsafe?
Hello, I'm experiencing crashes when I try to read tiff images / textures with osg. When I use other image formats all seems to work fine. Since I'm using a lot of threads I came to the conclusion that there's maybe a threading problem inside ReaderWriterTIFF.cpp. So I wrote a small testcase (see attachment, needs Qt) and valgrind --tool=helgrind gives me thisi answer: Code: ==20491== Possible data race during read of size 4 at 0x128e6270 by thread #4 ==20491==at 0x126E2518: simage_tiff_load(std::istream, int, int, int, unsigned short) (ReaderWriterTIFF.cpp:748) ==20491==by 0x126E3BF4: ReaderWriterTIFF::readImage(std::string const, osgDB::Options const*) const (ReaderWriterTIFF.cpp:793) ==20491==by 0x4EEB3DD: osgDB::Registry::ReadImageFunctor::doRead(osgDB::ReaderWriter) const (Registry.cpp:908) ==20491==by 0x4EE67C8: osgDB::Registry::read(osgDB::Registry::ReadFunctor const) (Registry.cpp:1103) ==20491==by 0x4EE76CA: osgDB::Registry::readImplementation(osgDB::Registry::ReadFunctor const, osgDB::Options::CacheHintOptions) (Registry.cpp:1277) ==20491==by 0x4EE7D44: osgDB::Registry::readImageImplementation(std::string const, osgDB::Options const*) (Registry.cpp:1355) ==20491==by 0x4EDBA30: osgDB::readImageFile(std::string const, osgDB::Options const*) (Registry:231) ==20491==by 0x4019AB: MyThread::run() (in /home/chehrlic/tds/osg-build-desktop-Qt_aus_PATH_Release/osg) ==20491==by 0x68FC024: QThreadPrivate::start(void*) (qthread_unix.cpp:331) ==20491==by 0x4C2A63D: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so) ==20491==by 0x6D1BF04: start_thread (in /lib64/libpthread-2.14.1.so) ==20491==by 0x778153C: clone (in /lib64/libc-2.14.1.so) ==20491== This conflicts with a previous write of size 4 by thread #2 ==20491==at 0x126E21E1: simage_tiff_load(std::istream, int, int, int, unsigned short) (ReaderWriterTIFF.cpp:652) ==20491==by 0x126E3BF4: ReaderWriterTIFF::readImage(std::string const, osgDB::Options const*) const (ReaderWriterTIFF.cpp:793) ==20491==by 0x4EEB3DD: osgDB::Registry::ReadImageFunctor::doRead(osgDB::ReaderWriter) const (Registry.cpp:908) ==20491==by 0x4EE67C8: osgDB::Registry::read(osgDB::Registry::ReadFunctor const) (Registry.cpp:1103) ==20491==by 0x4EE76CA: osgDB::Registry::readImplementation(osgDB::Registry::ReadFunctor const, osgDB::Options::CacheHintOptions) (Registry.cpp:1277) ==20491==by 0x4EE7D44: osgDB::Registry::readImageImplementation(std::string const, osgDB::Options const*) (Registry.cpp:1355) ==20491==by 0x4EDBA30: osgDB::readImageFile(std::string const, osgDB::Options const*) (Registry:231) ==20491==by 0x4019AB: MyThread::run() (in /home/chehrlic/tds/osg-build-desktop-Qt_aus_PATH_Release/osg) ==20491== The related piece of code is Code: currPtr = buffer + (h-1)*w*format; tifferror = ERR_NO_ERROR; // line 526 switch (pack(photometric, config)) And tifferror is a static variable which is accessed without a mutex (which would also be wrong - the variable needs to be in the TLS). Is my observation correct? And If so - can someone fix it for me? ;-) /add Looks like TiffSetError/WarningHandler needs also a mutex (Line 526 + 527) - at least valgrind complains about a problem there too (inside tiff library). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44204#44204 Attachments: http://forum.openscenegraph.org//files/osg_tifftar_197.gz ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org