[QGIS-Developer] Crashes in qgsogrfeatureiterator.cpp:52 on master
Even Rouault
even.rouault at spatialys.com
Thu Nov 9 14:07:11 PST 2017
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;
}
Assuming that on Windows futexAvailable() returns false (futex are Linux things only, aren't
they ?), then we go to to the main body
With timeout = -1, timer.remainingTime() will return -1 according to QDeadlineTimer doc, so
the while() loop is not taken. And there, if there's not enough resources available, the
function will return false... Bum !
Hence a Windows only bug, in the not so rare case where the pool has no free resource.
--
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/a7230971/attachment.html>
More information about the QGIS-Developer
mailing list