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

Poco::Data::SQLite::SQLiteStatementImpl::next() error #1461

Closed
micheleselea opened this issue Oct 19, 2016 · 8 comments
Closed

Poco::Data::SQLite::SQLiteStatementImpl::next() error #1461

micheleselea opened this issue Oct 19, 2016 · 8 comments
Assignees
Milestone

Comments

@micheleselea
Copy link
Contributor

I probably found a problem using SQLite Poco class and the "PRAGMA incremental_vacuum" command. On a debian jessy armv7l (kernel Linux 4.4.13-v7+) ditribution I always get a SEGMENTATION FAULT when I run the PRAGMA comment. With other PRAGMA (for example auto_vacuum or cache_size) I have no problem.
I tried on a Windows system and I can't get the error

Using directly sqlite3_exec(handle,"PRAGMA incremental_vacuum"...) works with handle taken from PocoSQLite session

the function that seems to SEGMENT is SQLiteStatementImpl::next()

I'll try on a debian not arm too, just to double check this behavior

@micheleselea
Copy link
Contributor Author

With a standard debian PC there's no problem...I'll investigate more, anyway to test the error the very first query to do on the db created, before all other command or table created is:
PRAGMA auto_vacuum=2

@micheleselea
Copy link
Contributor Author

The system I found problem is a Raspberry pi 3. I'll try with another Raspberry with a different system and let you know

@micheleselea
Copy link
Contributor Author

micheleselea commented Nov 28, 2016

Indeed I found the reason why "PRAGMA incremental_vacuum" throw a segmentation fault under Linux.
The problem is the line 276
_affectedRowCount += (*extracts.begin())->numOfRowsHandled();
when you do incremental_vacuum statement the extracts vector is empty so the line above (*extracts.begin()) crash. In windows does not crash probably just for a coincidence.
we have to check !=itEnd

@micheleselea micheleselea changed the title Poco::Data::SQLite PRAGMA incremental_vacuum error Poco::Data::SQLite::SQLiteStatementImpl::next() Nov 28, 2016
@micheleselea micheleselea changed the title Poco::Data::SQLite::SQLiteStatementImpl::next() Poco::Data::SQLite::SQLiteStatementImpl::next() error Nov 28, 2016
@obiltschnig obiltschnig added this to the Release 1.7.7 milestone Nov 28, 2016
@obiltschnig obiltschnig self-assigned this Nov 28, 2016
@obiltschnig
Copy link
Member

Cannot reproduce this, unfortunately. When executing above PRAGMA, SQLiteStatementImpl::next() isn't even called.

@micheleselea
Copy link
Contributor Author

micheleselea commented Dec 5, 2016 via email

@obiltschnig
Copy link
Member

Do you have a small code snippet to reproduce this? I'd like to better understand what's happening. And, btw., which POCO version are you using?

@micheleselea
Copy link
Contributor Author

I'm using the latest version 1.7.6 + some change to FTPSClient but nevermind for this.
I'm using SQLite 3.15.2 but was the same at least from 3.15.0 (ps. 3.15.0 had some problem with vacuum)
I found that the problem was not there with an in memory db but only with a file db.
I can reproduce the problem on a RaspBerryPi 3 with a dietpi or even with a raspbian (minibian version)

Unfortunatly I do not have the original lib, I should recompile but today I do not have enough time
anyway the theory you should reproduce it with this code
create a file DB like this

Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
tmp << "PRAGMA auto_vacuum=2", now;
tmp << "PRAGMA journal_mode=WAL", now;
tmp << "CREATE TABLE test (Id INTEGER PRIMARY KEY AUTOINCREMENT,datetime BIGINT,Info TEXT)", now;
tmp << "PRAGMA incremental_vacuum", now;

and you should get in the problem if you do not check extract.begin()!=end()

@obiltschnig
Copy link
Member

obiltschnig commented Dec 7, 2016

Still haven't been able to reproduce, but added check, which is good practice anyway. Also, this check is in develop branch already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants