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

QGIS crashes/freezes when adding a large CSV file as delimited text layer #36392

Closed
fet760 opened this issue May 13, 2020 · 17 comments · Fixed by #36778
Closed

QGIS crashes/freezes when adding a large CSV file as delimited text layer #36392

fet760 opened this issue May 13, 2020 · 17 comments · Fixed by #36778
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!

Comments

@fet760
Copy link

fet760 commented May 13, 2020

Operating system: Windows 10 Pro (Version 1909)
QGIS Version: 3.12
Attaching the xlsx version of the csv file as github doesnt support csv files.
I was not having this issue until today. Started using QGIS version 3.10 (more stable) last week and this morning was working fine until noon where it started crashing when uploading this delimited text layer. I restarted my pc, nothing, unistalled version 3.10 and installed version 3.12 but the problem persisted. Thanks for any type of help in advance.
ATT.xlsx

@fet760 fet760 added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 13, 2020
@gioman
Copy link
Contributor

gioman commented May 13, 2020

Attaching the xlsx version of the csv file as github doesnt support csv files.

@fet760 just ZIP your CSV and attach it here (github takes ZIPs).

@gioman gioman added the Feedback Waiting on the submitter for answers label May 13, 2020
@gioman
Copy link
Contributor

gioman commented May 13, 2020

@fet760 also try with a new QGIS profile.

@fet760
Copy link
Author

fet760 commented May 13, 2020 via email

@gioman
Copy link
Contributor

gioman commented May 13, 2020

@fet760 settings > user profiles > new profile

@fet760
Copy link
Author

fet760 commented May 13, 2020 via email

@gioman
Copy link
Contributor

gioman commented May 13, 2020

@fet760 please attach the original CSV file (as zip).

@fet760
Copy link
Author

fet760 commented May 13, 2020

ATT CSV.zip

@gioman
Copy link
Contributor

gioman commented May 13, 2020

ATT CSV.zip

in my case it causes a freeze rather than a crash, but... the CSV is mostly made of empty cells (of about 1 million lines only ~300 contain data). If you isolate the lines with data it opens with no issues. Now it must e seen if the problem are the empty lines or if is a more general issue with CSVs with so many (empty or not) lines.

@fet760
Copy link
Author

fet760 commented May 13, 2020

could you guide me on how to isolate the lines with data.

@gioman
Copy link
Contributor

gioman commented May 13, 2020

could you guide me on how to isolate the lines with data.

open the CSV in a robust text editor (not notepad, if you are on Windows use Notepad++) select the lines with data, copy and paste in a new text file with .csv extension.

@fet760
Copy link
Author

fet760 commented May 13, 2020

I selected all the blank cells and deleted them. The file went from 11MB to 27KB. It works now. Thanks for your time and help sir hope you have a great rest of the day.

@fet760 fet760 closed this as completed May 13, 2020
@gioman gioman reopened this May 13, 2020
@gioman
Copy link
Contributor

gioman commented May 13, 2020

Reopening as the issue remains.

@gioman gioman changed the title QGIS Crashing when adding cvs file as delimited text layer QGIS crashes/freezes when adding a large CSV file as delimited text layer May 14, 2020
@gioman gioman removed the Feedback Waiting on the submitter for answers label May 14, 2020
rouault added a commit to rouault/QGIS that referenced this issue May 27, 2020
Fixes qgis#36392
Fixes qgis#21976
Fixes qgis#17190

We are obliged to do 'at hand' parsing due to QT not handling CR-only
end of lines.
As we are at it, also limit each line to 1 MB to avoid potential denial
of service (which was what close to what happened here before the CR-only
parsing fix)

Add tests for parsing CR-only end of lines, and exercising the at-hand
buffering logic
rouault added a commit to rouault/QGIS that referenced this issue May 27, 2020
Set to 10000 by default. Can be overriden through settings.

This is only for the preview in the source select dialog. (Attribute
table performs badly for much less columns)

Related to qgis#36392
rouault added a commit that referenced this issue May 28, 2020
Fixes #36392
Fixes #21976
Fixes #17190

We are obliged to do 'at hand' parsing due to QT not handling CR-only
end of lines.
As we are at it, also limit each line to 1 MB to avoid potential denial
of service (which was what close to what happened here before the CR-only
parsing fix)

Add tests for parsing CR-only end of lines, and exercising the at-hand
buffering logic
rouault added a commit that referenced this issue May 28, 2020
Set to 10000 by default. Can be overriden through settings.

This is only for the preview in the source select dialog. (Attribute
table performs badly for much less columns)

Related to #36392
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Jul 9, 2020
Fixes qgis#36392
Fixes qgis#21976
Fixes qgis#17190

We are obliged to do 'at hand' parsing due to QT not handling CR-only
end of lines.
As we are at it, also limit each line to 1 MB to avoid potential denial
of service (which was what close to what happened here before the CR-only
parsing fix)

Add tests for parsing CR-only end of lines, and exercising the at-hand
buffering logic

(cherry picked from commit 644a564)
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Jul 9, 2020
Set to 10000 by default. Can be overriden through settings.

This is only for the preview in the source select dialog. (Attribute
table performs badly for much less columns)

Related to qgis#36392

(cherry picked from commit fcf6203)
nyalldawson pushed a commit that referenced this issue Jul 21, 2020
Fixes #36392
Fixes #21976
Fixes #17190

We are obliged to do 'at hand' parsing due to QT not handling CR-only
end of lines.
As we are at it, also limit each line to 1 MB to avoid potential denial
of service (which was what close to what happened here before the CR-only
parsing fix)

Add tests for parsing CR-only end of lines, and exercising the at-hand
buffering logic

(cherry picked from commit 644a564)
nyalldawson pushed a commit that referenced this issue Jul 21, 2020
Set to 10000 by default. Can be overriden through settings.

This is only for the preview in the source select dialog. (Attribute
table performs badly for much less columns)

Related to #36392

(cherry picked from commit fcf6203)
@pocwiard
Copy link

pocwiard commented Jun 2, 2021

Same thing happens in 3.18, opening the attribute table for large point layer (few millions points) freezes and never finishes.
PC: i9 with 64GB
Is there a work around it?
I need to add three attributes and re-export as SCV.
thanks

@gioman
Copy link
Contributor

gioman commented Jun 2, 2021

Is there a work around it?

@pocwiard try QGIS master, I think there has been a fix recently (but I may be wrong).

@pocwiard
Copy link

pocwiard commented Jun 2, 2021

@gioman thanks. I tried to locate how to download the master but I failed miserably. Is there an easy way to download the master?

@gioman
Copy link
Contributor

gioman commented Jun 2, 2021

@gioman thanks. I tried to locate how to download the master but I failed miserably. Is there an easy way to download the master?

@pocwiard try here https://qgis.org/downloads/weekly/

@pocwiard
Copy link

pocwiard commented Jun 2, 2021

@gioman thank you very much!

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!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants