Bug report #16046

QGIS 2.14/2.18 crashes loading project with MSSQL layers

Added by Andre Jesus over 2 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Data Provider/MSSQL
Affected QGIS version:2.18.2 Regression?:Yes
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:Yes Copied to github as #:23961

Description

I'm trying to figure out what is happening that some clients and myself are getting too much force closes using QGIS 2.18.2.

I tried Process Monitor (Sysinternals) and I notice there a 4x more Buffer Overflow errors using 2.18.2 than 2.8.9.

I simply tried to open one of my many problematic projects files (PADRAO.qgs) to check what is going on:

1. Open a QGIS 2.8.9 and 2.18.2 instances
2. Start monitoring
3. Load the project file

Results: qgis.CSV
2.18.2 = ~200 buffer overflow errors
2.8.9 = ~50 buffer overflow erros

Using 2.18.2 I can't do anything, every time I tried to pan or zoom out I get force closes. Using 2.8.9 is perfectly fine.

Is this related to the number of errors I'm getting?

qgis.CSV Magnifier - results (66.2 KB) Andre Jesus, 2017-01-06 05:24 AM

PADRAO.qgs - project file (542 KB) Andre Jesus, 2017-01-06 05:24 AM

2.18.LOG Magnifier (1.31 KB) Andre Jesus, 2017-01-06 05:34 AM

Desktop.rar (2.96 MB) Andre Jesus, 2017-01-06 07:57 AM

data.rar (2.16 MB) Andre Jesus, 2017-01-06 11:37 AM

History

#1 Updated by Andre Jesus over 2 years ago

I'm also getting those warnings (2.18.LOG) using SysInternals DebugView

#2 Updated by Giovanni Manghi over 2 years ago

  • Category set to Project Loading/Saving
  • Status changed from Open to Feedback

The project with no data has no issues here on 2.18.2 Linux/Windows.
If the data is important to replicate the issue please attach it.

#3 Updated by Andre Jesus over 2 years ago

Unfortunately I can't send you this data because is not open. I'm attaching a dump files.

I can, tho, set up a Teamviewer session.

If it's not possible, sorry for the wasted time.

#4 Updated by Andre Jesus over 2 years ago

At first I thought the geometry_column table was the problem, but it wasn't.

I have two tables that have given me FC all the time I keep zooming them around.

I exported them to sqlite. In file format they work normal.

Then I created two new tables in a MSSQL 2008 database, copy the sqlite geometries and copied them into the tables.

Some zooming around and FC, just like the original MSSQL data.

I also loaded them into a MSSQL 2016 database, same errors.

Finally I loaded them into a PostgreSQL 9.6 database, no erros at all.

#5 Updated by Andre Jesus over 2 years ago

Here are those two tables

#6 Updated by Giovanni Manghi over 2 years ago

So, to resume:

this only happens when your data is in MS SQL Server format, correct?

In previous QGIS releases (2.8, others?) it worked ok, correct?

#7 Updated by Andre Jesus over 2 years ago

Giovanni Manghi wrote:

So, to resume:

this only happens when your data is in MS SQL Server format, correct?

In previous QGIS releases (2.8, others?) it worked ok, correct?

That is correct. I tried the same MSSQL layers in 2.8.4 and 2.8.9 QGIS versions and they opened and worked normally.

2.14.x also has problems.

#8 Updated by Giovanni Manghi over 2 years ago

  • Category changed from Project Loading/Saving to Data Provider/MSSQL
  • Subject changed from Buffer overfllow to QGIS 2.14/2.18 crashes loading project with MSSQL layers
  • Priority changed from High to Severe/Regression

Tagging as regression as it was ok on 2.8.*

#9 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Feedback to Open

#10 Updated by Johanna Botman over 2 years ago

I am using QGIS 2.14.4 and MSSQL 2014 and do not have any issues. I would like to upgrade to 2.18.4 and would like to know if it is likely that I could experience this bug if I have not seen it in my current version.

#11 Updated by Andre Jesus over 2 years ago

Johanna Botman wrote:

I would like to upgrade to 2.18.4

Have you tried with the data I attached?

I did the same steps again but now using 2.18.4 and I got the same Force Close when pan and zooming around.

1.

--create test line table
create table test_line (id int identity(1,1) primary key, geometry geometry)

--create spatial index
CREATE SPATIAL INDEX [test_line_SPIX] ON [dbo].test_line
(
[GEOMETRY]
)USING GEOMETRY_GRID
WITH (BOUNDING_BOX =(579789, 8256994, 617921, 8311924), GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

--create test polygon table
create table test_poly (id int identity(1,1) primary key, geometry geometry)

--create spatial index
CREATE SPATIAL INDEX [test_poly_SPIX] ON [dbo].test_poly
(
[GEOMETRY]
)USING GEOMETRY_GRID
WITH (BOUNDING_BOX =(579789, 8256994, 617921, 8311924), GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM),
CELLS_PER_OBJECT = 16, PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

2.
- Open QGIS, Load sqlite files
- Add test tables, enable edit and copy sqlite data into the test tables, save.

3.
- Pan and Zoom around for a few seconds and FC

#12 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Open to Feedback

#13 Updated by Johanna Botman over 2 years ago

In Step 2, you ask to load sqlite files as part of the testing process.

Your bug report says MSSQL. It is the issue with MSSQL that is the deal breaker for my IT Unit. Can you please clarify?

#14 Updated by Giovanni Manghi over 2 years ago

Johanna Botman wrote:

In Step 2, you ask to load sqlite files as part of the testing process.

Your bug report says MSSQL. It is the issue with MSSQL that is the deal breaker for my IT Unit. Can you please clarify?

you have to load the provided sqlite data into a mssql database.

#15 Updated by Andre Jesus over 2 years ago

Johanna Botman wrote:

In Step 2, you ask to load sqlite files as part of the testing process.

Your bug report says MSSQL. It is the issue with MSSQL that is the deal breaker for my IT Unit. Can you please clarify?

Sure.

1. Download data.rar (2.2 MB) file from this thread attachments.
2. Open QGIS and load both line.sqlite and polygon.sqlite
3. Load the two created MSSQL layers (test_line and test_poly)
4. Select all line.sqlite geometries, go to Edit > Copy Features
5. Enable edit to test_line, go to Edit > Paste Features. Save the edition.
6. Repeat steps 4 and 5 to polygon.sqlite/test_poly layers.

Now you can remove both sqlite layer and start pan and zoom around test_line/test_poly. 3~5 seconds is a guarantied Force Close for me.

#16 Updated by Johanna Botman over 2 years ago

OK, so this introduces sqlite into the mix.

My concerns were with MSSQL and QGIS and that this would be a deal breaker for my IT Unit in my upgrade path. We do not use sqlite.

My apologies for the noise here.

#17 Updated by Giovanni Manghi over 2 years ago

Johanna Botman wrote:

OK, so this introduces sqlite into the mix.

no it does not. The sqlite datasources here are just meant as "intermediate" format to allow you load data in MSSQL server and test if you have the same issue reported here.

#18 Updated by Giovanni Manghi over 2 years ago

3.
- Pan and Zoom around for a few seconds and FC

I did all the necessary, I think.

Got a copy of SQL Server 2014
Run your SQL queries to create tables
Copy/pasted the features in those tables from your spatialite data
Fooled around for minutes... no crash whatsoever.

Env: a clean Win 7 machine with QGIS 2.18.7 from osgeo4w 64bit.

#19 Updated by Giovanni Manghi over 2 years ago

  • Regression? set to Yes

#20 Updated by Giovanni Manghi over 2 years ago

  • Priority changed from Severe/Regression to High

#21 Updated by Giovanni Manghi over 2 years ago

  • Easy fix? set to No

#22 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Feedback to Closed
  • Description updated (diff)
  • Resolution set to not reproducable

Closing for lack of feedback, please reopen if you find a new way that allows the issue be replicated on any system.

Also available in: Atom PDF