Bug report #19455

Updated by Jürgen Fischer almost 2 years ago

This issue appears to be similar to a previous problem #12324 https://issues.qgis.org/issues/12324 on QGIS 2.8 Wien

h2. User Feedback

Add MSSQL layer to canvas and pan the canvas around. QGIS crashes. Alternatively, add 1 layer, then without interacting with the canvas, add a second layer, QGIS crashes.

h2. Report Details

*Crash ID*: 5bfd6ac6f67d8a578b91a0865116ad7a62cabaea

*Stack Trace*
<pre>
RtlEnterCriticalSection :
ODBCSetTryWaitValue :
LockHandle :
SQLGetStmtAttrW :
QSqlDatabase::open :
sourceSelectProviders :
sourceSelectProviders :
QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator :
QgsVectorLayerFeatureSource::getFeatures :
QgsVectorLayerLabelProvider::registerFeature :
QgsMapRendererCustomPainterJob::doRender :
QgsMapRendererCustomPainterJob::staticRender :
QgsLayoutItemAttributeTable::maximumNumberOfFeatures :
QThreadPoolPrivate::reset :
QThread::start :
BaseThreadInitThunk :
RtlUserThreadStart :
</pre>

*QGIS Info*
QGIS Version: 3.2.0-Bonn
QGIS code revision: commit:bc43194061
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

*System Info*
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.17134

*Database Engine*
Microsoft SQL Server 2012 (SP4) (KB4018073) - 11.0.7001.0 (X64) Aug 15 2017 10:23:29 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

Here is a simple MRE, run this code against your database. Navigate to it in QGIS and "Add selected layer(s) to canvas". Just pan around a bit and QGIS crashes.
IF OBJECT_ID('dbo.[qgis_temp_2]') IS NOT NULL drop table dbo.[qgis_temp_2];
CREATE TABLE dbo.[qgis_temp_2]
(
[OBJECTID] [int] NOT NULL
,[the_geom] [geometry] NULL
,CONSTRAINT [PK_qgis_temp_2_OBJECTID] PRIMARY KEY CLUSTERED ([OBJECTID])
);

with
the_points as
(
select cast(1 as int) as OBJECTID, geometry::STPointFromText('POINT (-8.317927 53.301678)', 4326) as the_geom union all
select cast(2 as int) as OBJECTID, geometry::STPointFromText('POINT (-8.317833 53.301747)', 4326) as the_geom union all
select cast(3 as int) as OBJECTID, geometry::STPointFromText('POINT (-8.242390 53.313442)', 4326) as the_geom
)
insert into dbo.qgis_temp_2 (OBJECTID, the_geom)
select OBJECTID, the_geom
from the_points;

I am snookered now. Most of my spatial is in MSSQL. No option in DBManager for MSSQL, and separately, as a workaround, I am having trouble connecting to my SQL Server instance from Postgres via Foreign Tables and via FreeTDS/tsql!! Lots of hoops to jump through for MSSQL users. :-(

Back