[QGIS-Developer] Crashes in qgsogrfeatureiterator.cpp:52 on master

Even Rouault even.rouault at spatialys.com
Thu Nov 9 14:24:55 PST 2017


On jeudi 9 novembre 2017 23:07:11 CET Even Rouault wrote:
> On vendredi 10 novembre 2017 07:24:09 CET Nyall Dawson wrote:
> > Hi all (specifically bugfixing devs)
> > 
> > While doing a bunch of mapping tasks yesterday on master (i.e. being a
> > QGIS user, not a developer!) I hit a bunch of frequent crashes on
> > Windows. Nathan's awesome crash report tool identified the issue as
> > occurring at qgsogrfeatureiterator.cpp:52.
> > 
> > Looking into that some more it seems that the previous line is failing
> > to acquire the connection to the datasource. I can't see anything
> > which would obviously explain this (failing a bug in Qt's
> > QSemaphore::tryAcquire e.g. possibly exposed by 49de489c).
> 
> This hypothesis is not so impossible. I had first a look at Qt4 tryAcquire
> implementation, and I can't see how it would fail. But for Qt5,  I found
> https://code.woboq.org/qt5/qtbase/src/corelib/thread/qsemaphore.cpp.html
> (not sure which point version this is)
> 
> bool QSemaphore::tryAcquire(int n, int timeout)
> {
>     Q_ASSERT_X(n >= 0, "QSemaphore::tryAcquire", "parameter 'n' must be
> non-negative"); if (futexAvailable())
>         return futexSemaphoreTryAcquire<true>(u, n, timeout < 0 ? -1 :
> timeout); QDeadlineTimer timer(timeout);
>     QMutexLocker locker(&d->mutex);
>     qint64 remainingTime = timer.remainingTime();
>     while (n > d->avail && remainingTime > 0) {
>         if (!d->cond.wait(locker.mutex(), remainingTime))
>             return false;
>         remainingTime = timer.remainingTime();
>     }
>     if (n > d->avail)
>         return false;
>     d->avail -= n;
>     return true;
> }

Digging further this code comes from the dev branch of qt5:
https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qsemaphore.cpp#L414

Released branches use a different logic:
https://github.com/qt/qtbase/blob/5.10/src/corelib/thread/qsemaphore.cpp#L217

Are you running bleeding edge Qt ?

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171109/597d9c22/attachment.html>


More information about the QGIS-Developer mailing list