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

100% cpu on marker symbol placed on center of a degenerate linestring #34396

Closed
mhugo opened this issue Feb 10, 2020 · 3 comments · Fixed by #34407
Closed

100% cpu on marker symbol placed on center of a degenerate linestring #34396

mhugo opened this issue Feb 10, 2020 · 3 comments · Fixed by #34407
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers

Comments

@mhugo
Copy link

mhugo commented Feb 10, 2020

Describe the bug

A single layer with a simple symbology made of a line with marker symbol generates a 100% CPU load.

How to Reproduce

Download the project file and dataset from
https://share.oslandia.net/public/a48028

Open it and stare at your CPU burning ...

QGIS and OS versions

Linux Debian.

QGIS master commit ef108f3 (2020-02-10)

Additional context

When we zoom in, save the project, kill qgis, restart it and open the project again, the cpu load is normal. When zooming out, it starts to increase the cpu load.

From an attached gdb session, we can see that something seems to go wrong in QgsTemplatedLineSymbolLayerBase::collectOffsetPoints

#0  0x000055555556d3ef in QArrayData::data() (this=0x7fff5c169a50) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:59
#1  0x00007ffff372a052 in QTypedArrayData<QPointF>::data() (this=0x7fff5c169a50) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:206
#2  0x00007ffff3729072 in QTypedArrayData<QPointF>::begin(QPointF*) (this=0x7fff5c169a50)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:209
#3  0x00007ffff37ebb0e in QVector<QPointF>::data() (this=0x7fff67bef048) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:127
#4  0x00007ffff37eb271 in QVector<QPointF>::operator[](int) (this=0x7fff67bef048, i=0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qvector.h:437
#5  0x00007ffff37e498a in QgsTemplatedLineSymbolLayerBase::collectOffsetPoints(QVector<QPointF> const&, QVector<QPointF>&, double, double, double, int) (p={...}, dest=<empty>, intervalPainterUnits=0, initialOffset=0, initialLag=0, numberPointsRequired=2)
    at ../src/core/symbology/qgslinesymbollayer.cpp:1594
#6  0x00007ffff37e4f58 in QgsTemplatedLineSymbolLayerBase::renderPolylineCentral(QPolygonF const&, QgsSymbolRenderContext&, double) (this=0x5555570fadf0, points=..., context=..., averageAngleOver=7.559055118110237) at ../src/core/symbology/qgslinesymbollayer.cpp:1668
#7  0x00007ffff37de9a6 in QgsTemplatedLineSymbolLayerBase::renderPolyline(QPolygonF const&, QgsSymbolRenderContext&) (this=0x5555570fadf0, points=..., context=...) at ../src/core/symbology/qgslinesymbollayer.cpp:825
#8  0x00007ffff38abea2 in QgsLineSymbol::renderPolylineUsingLayer(QgsLineSymbolLayer*, QPolygonF const&, QgsSymbolRenderContext&) (this=0x555557331480, layer=0x5555570fadf0, points=..., context=...) at ../src/core/symbology/qgssymbol.cpp:2004
#9  0x00007ffff38abb72 in QgsLineSymbol::renderPolyline(QPolygonF const&, QgsFeature const*, QgsRenderContext&, int, bool) (this=0x555557331480, points=..., f=0x7fff67befe10, context=..., layerIdx=-1, selected=false) at ../src/core/symbology/qgssymbol.cpp:1978
#10 0x00007ffff38a5553 in QgsSymbol::renderFeature(QgsFeature const&, QgsRenderContext&, int, bool, bool, int, double) (this=0x555557331480, feature=..., context=..., layer=-1, selected=false, drawVertexMarker=false, currentVertexMarkerType=1, currentVertexMarkerSize=2)
    at ../src/core/symbology/qgssymbol.cpp:913
#11 0x00007ffff381d16a in QgsFeatureRenderer::renderFeatureWithSymbol(QgsFeature const&, QgsSymbol*, QgsRenderContext&, int, bool, bool) (this=0x5555576583c0, feature=..., symbol=0x555557331480, context=..., layer=-1, selected=false, drawVertexMarker=false)
    at ../src/core/symbology/qgsrenderer.cpp:135
#12 0x00007ffff381d0fc in QgsFeatureRenderer::renderFeature(QgsFeature const&, QgsRenderContext&, int, bool, bool) (this=0x5555576583c0, feature=..., context=..., layer=-1, selected=false, drawVertexMarker=false) at ../src/core/symbology/qgsrenderer.cpp:129
#13 0x00007ffff3f6eb43 in QgsVectorLayerRenderer::drawRenderer(QgsFeatureIterator&) (this=0x555557873240, fit=...)
    at ../src/core/qgsvectorlayerrenderer.cpp:325
#14 0x00007ffff3f6e312 in QgsVectorLayerRenderer::render() (this=0x555557873240) at ../src/core/qgsvectorlayerrenderer.cpp:282
#15 0x00007ffff3d3cdc8 in QgsMapRendererParallelJob::renderLayerStatic(LayerRenderJob&) (job=...)
    at ../src/core/qgsmaprendererparalleljob.cpp:353
@mhugo mhugo added Symbology Related to vector layer symbology or renderers High Priority Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Feb 10, 2020
@haubourg
Copy link
Member

@mhugo I reproduce the issue with your project, but not with other datasets of mine.
I exported your dataset to shp and applied a symbol marker line, saved the project, opened it again and the problem is not here any more.
Back to gpkg again with the same dataset and no issue again.

It seems you hit a particular nasty case !

@mhugo
Copy link
Author

mhugo commented Feb 10, 2020

@haubourg many thanks for the test ! I'll dig deeper ...

@mhugo mhugo changed the title 100% cpu with a simple marker symbol symbology 100% cpu on marker symbol placed on center of a degenerate linestring Feb 11, 2020
@mhugo mhugo self-assigned this Feb 11, 2020
@mhugo
Copy link
Author

mhugo commented Feb 11, 2020

The problem comes from a degenerate linestring which is defined by two points with the same coordinates. That should be an easy fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Symbology Related to vector layer symbology or renderers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants