[osg-users] Crash in ReaderWriterCURL::readFile when used with DatabasePager

Robert Osfield robert.osfield at gmail.com
Mon Dec 18 00:15:39 PST 2017


HI Hartwing,

Which version of the OSG are you testing under?

Robert.

On 17 December 2017 at 23:46, Hartwig Wiesmann
<hartwig.wiesmann at skywind.eu> wrote:
> Hi,
>
> I am using PagedLOD together with a pseudo-loader to load files via the network. To load the files the ReaderWriterCURL class is used.
>
> The database pager is set up with one general and one HTTP thread. This means that the ReaderWriterCURL::readFile(ObjectType, const std::string&, const osgDB::ReaderWriter::Options*) (and WriteFile) method is always called from the same thread!
>
> In ReaderWriterCURL::readFile the class method getEasyCurl() is used to get a reference to an EasyCurl object. And always the same EasyURL object is returned because it is always the same thread that is calling getEasyCurl().
>
> The problem is (seems to be) that although the ReaderWriterCURL::readFile is used by the same thread it can happen that different instances of ReaderWriterCURL::readFile are running in parallel (verified by debug output). But this means that these instances use the SAME EasyCURL object! And this will lead to a crash.
>
> For testing purposes I replaced the call to getEasyCurl in ReaderWriterCURL::readFile with osg::ref_ptr<EasyCurl> easyCurl and did the corresponding replacements ("." replaced by "->") and everything went smoothly.
>
> I do not know the purpose of getEasyCur() using a map of EasyCurl objects as this method is only used in ReaderWriterCURL::readFile and writeFile. The only thing that has to be prevented is that curl_easy_init() is called in parallel. But this can also be achieved by returning an osg::ref_ptr<EasyCurl> object in combination with a lock.
>
> Awaiting your comments!
>
> Cheers,
> Hartwig
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72591#72591
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list