Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector / raster tiles layer throws error when rendering #3

Open
wonder-sk opened this issue Sep 26, 2023 · 1 comment
Open

Vector / raster tiles layer throws error when rendering #3

wonder-sk opened this issue Sep 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@wonder-sk
Copy link
Member

Rendering of vector tiles or raster tiles throws a RuntimeError "operation does not support unaligned accesses"

First there are a couple of suspicious warnings from QgsNetworkAccessManager code:

qgis-js.js:1631 qt.core.qobject.connect: QObject::connect(QgsNetworkAccessManager, Unknown): invalid nullptr parameter
qgis-js.js:1631 qt.core.qobject.connect: QObject::connect(QgsNetworkAccessManager, QgsNetworkAccessManager): invalid nullptr
qgis-js.js:1631 qt.core.qobject.connect: QObject::connect(QgsNetworkAccessManager, Unknown): invalid nullptr parameter

In case of raster tile layer: (wms provider with xyz service type)

qgis-js.worker.js:68 RuntimeError: operation does not support unaligned accesses
    at QBasicMutex::lockInternal(int) (qgis-js.wasm:0x1b4a57)
    at QRecursiveMutex::tryLock(int) (qgis-js.wasm:0x1b48f4)
    at QgsNetworkAccessManager::setupDefaultProxyAndCache(Qt::ConnectionType) (qgis-js.wasm:0x581770)
    at QgsNetworkAccessManager::instance(Qt::ConnectionType) (qgis-js.wasm:0x57f546)
    at QgsTileCache::tile(QUrl const&, QImage&) (qgis-js.wasm:0x1884371)
    at QgsWmsProvider::draw(QgsRectangle const&, int, int, QgsRectangle&, double&, QgsRasterBlockFeedback*) (qgis-js.wasm:0x194d54e)
    at QgsWmsProvider::readBlock(int, QgsRectangle const&, int, int, void*, QgsRasterBlockFeedback*) (qgis-js.wasm:0x1953332)
    at QgsRasterDataProvider::block(int, QgsRectangle const&, int, int, QgsRasterBlockFeedback*) (qgis-js.wasm:0xd2108a)
    at non-virtual thunk to QgsRasterDataProvider::block(int, QgsRectangle const&, int, int, QgsRasterBlockFeedback*) (qgis-js.wasm:0xd22314)
    at QgsSingleBandColorDataRenderer::block(int, QgsRectangle const&, int, int, QgsRasterBlockFeedback*) (qgis-js.wasm:0xd86462)

In case of vector tile layer:

qgis-js.worker.js:68 RuntimeError: operation does not support unaligned accesses
    at QBasicMutex::lockInternal(int) (qgis-js.wasm:0x1b4a57)
    at QRecursiveMutex::tryLock(int) (qgis-js.wasm:0x1b48f4)
    at QgsNetworkAccessManager::setupDefaultProxyAndCache(Qt::ConnectionType) (qgis-js.wasm:0x581770)
    at QgsNetworkAccessManager::instance(Qt::ConnectionType) (qgis-js.wasm:0x57f546)
    at QgsTileDownloadManagerWorker::queueUpdated() (qgis-js.wasm:0xa2df28)
    at QtPrivate::QSlotObject<void (QgsTileDownloadManagerWorker::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qgis-js.wasm:0xa2dbae)
    at QMetaCallEvent::placeMetaCall(QObject*) (qgis-js.wasm:0xe9091)
    at QObject::event(QEvent*) (qgis-js.wasm:0xebd08)
    at QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) (qgis-js.wasm:0xb65fe)
    at QCoreApplication::notify(QObject*, QEvent*) (qgis-js.wasm:0xb66c5)
@wonder-sk
Copy link
Member Author

It looks like the network access manager was misbehaving only on worker threads, it worked fine on the main thread. I have managed to get a quick fix done by returning early from QgsNetworkAccessManager::setupDefaultProxyAndCache() - after the connections are made, but before the proxy and cache get set up.

That however lead to a bunch of other issues - first I was getting an error about having used all threads - so I have increased the thread pool size in CMakeLists.txt. Then, I could see that browser fetches the tiles as needed, but map was still not getting rendered, with some weird fatal errors happening somewhere deep inside Qt, like this (when running in debug build):

ASSERT: "!g_staticDataMutex.try_lock()" in file /home/martin/qgis/qgis-js/build/vcpkg/buildtrees/qtbase/src/here-src-6-9daf605cd3.clean/src/corelib/kernel/qeventdispatcher_wasm.cpp, line 206

and

ASSERT: "d_ptr.loadRelaxed()" in file /home/martin/qgis/qgis-js/build/vcpkg/buildtrees/qtbase/wasm32-emscripten-qt-threads-dbg/include/QtCore/../../../src/here-src-6-9daf605cd3.clean/src/corelib/thread/qmutex.h, line 48

This would need more investigation what's going on there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant