Bug 262670 - Soprano: "SQLExecDirect failed on query..."
Summary: Soprano: "SQLExecDirect failed on query..."
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian Trueg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-09 17:18 UTC by Luis Silva
Modified: 2012-04-01 10:39 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luis Silva 2011-01-09 17:18:14 UTC
Version:           4.6 (using KDE 4.5.95) 
OS:                Linux

My .xsession-errors is spammed with messages from nepomuk and soprano. At this point the virtuoso-t binary takes as much CPU as it can for hours. The messages are similar to the following and seem to be the result of a bad query construct:

[/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(2025)" Soprano: "SQLExecDirect failed on query 'sparql  select distinct ?r ?reqProp1 where { { { ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#isRead> 'false'^^<sopranofakes:/booleanHackUntilVirtuosoProblemIsResolved> . } UNION { ?r <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#hasTag> <nepomuk:/re' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '<' before 'nepomuk:' at '' immediately before end of statement)"


Reproducible: Always

Steps to Reproduce:
Just turn nepomuk on.



I am using the kdepim 2.0.89. The faulty queries might come from the akonadi feeders.
Comment 1 Sebastian Trueg 2011-01-10 10:03:45 UTC
Assigning this one to Akonadi as the query indeed comes from Akonadi.
Comment 2 Luis Silva 2011-01-15 18:14:48 UTC
After looking at a few more similar outputs of this bug it seems that the queries are being truncated at 264 characters and therefore are not valid. Can anyone validate this observation?
Comment 3 Andre Woebbeking 2011-05-17 08:48:47 UTC
Right, the queries seem to be truncated, here after 263 characters.
Comment 4 jansen 2011-06-03 11:31:51 UTC
Same here.
Using Akonadi 1.5.3, kontact-4.5.96-6.1.x86_64 on openSuSE 11.4, 64Bit (Kontact2 installed from repo "http://download.opensuse.org/repositories/KDE:/Unstable:/SC:/kdepim46/openSUSE_11.4/").
Currently I'm removing .xsession-errors every now and then when it´s size exceeds a gigabyte...
Comment 5 Elias Probst 2011-09-08 11:35:29 UTC
The initially reported error is gone since 4.6.0 if I remember correctly.

But now, an error related to this query shows up very often.
select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('signatur'), ?v4))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#me

This query clearly misses some closing } and probably some more, but I wasn't able yet to track down the source which actually creates this query.

The question is, which components actually cause this truncation and why?
Is a wrong datatype used by Akonadi to build the query strings?
Does Nepomuk or Virtuoso truncate it?
Comment 6 Ferdinand Gassauer 2011-10-10 11:47:52 UTC
using 4.7.2 from OpenSuSE

1) I added .xsession-errors to the ignore list to avoid indexing

2) get the following error

"/usr/bin/nepomukservicestub(4978)" Soprano: "SQLExecDirect failed on query 'sparql select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector(bif:charset_recode('yasss', '_WIDE_', 'UTF-8')), ?v2))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#messageSubject> ?v2 . FILTER(bif:contains(?v2, "'yasss'")) . ?r a <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email> . } . ?r <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible> ?v1 . FILTER(?v1>0) . }' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]IN013: Wide source charset specified, but the supplied string not wide)"

BTW - in kmail2 (4.7.2) the search does not return any results any more

looks like  a show stopper
Comment 7 Stephan Diestelhorst 2012-02-02 19:47:10 UTC
This just happened again with Kubuntu's 4.8 packages on Oneiric. Started from a fresh virtuoso backend and moved old *nepomuk* config files away. Nepomuk would then go ahead and reindex, so far so good.

However, after a suspend-to-ram cycle, waking up outside the company network, on battery power, virtuoso-t is taking up many precious cycles and spamming .xsession-errors with many of these:

[/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(18218)" Soprano: "SQLExecDirect failed on query 'sparql select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('ASF'), ?v2))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#message' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: syntax error at '#')"

and every now and then:

[/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(18218)" Soprano: "Invalid iterator."

Note that the file indexer is idle, due to battery power, and the Akonadi Nepomuk Feeder reports being idle, due to system load, too.
Comment 8 Stephan Diestelhorst 2012-02-02 19:53:21 UTC
Just a quick update: Killing Nepomuk with

qdbus org.kde.NepomukServer /nepomukserver     org.kde.NepomukServer.quit

and then restarting with 

nepomukserver 2> /tmp/nepomukserver &

results in the same errors coming up. Now only in a different file :/
Comment 9 Stephan Diestelhorst 2012-02-02 20:02:15 UTC
... however, things stabilise after 26 rounds of "Invalid iterator." and 2006 of the "SQLExecDirect failed on query ... error at '#')" messages virtuoso is back to indexing my mail (though doing it on battery is not so nice).
Comment 10 Stephan Diestelhorst 2012-02-03 13:55:09 UTC
Nevertheless, search is broken. When I search for "foo", I get 266100  [/usr/bin/nepomukservicestub] "/usr/bin/nepomukservicestub(3978)" Soprano: "SQLExecDirect failed on query 'sparql select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('foo'), ?v4))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#message' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: syntax error at '#')"
Comment 11 Eric MSP Veith 2012-02-18 15:13:18 UTC
I can confirm this on an openSUSE 12.1 with KDE 4.8.0 and Soprano 2.7.4. The error message is slightly different, though:

"/usr/bin/nepomukservicestub(2970)" Soprano: "SQLExecDirect failed on query 'sparql select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('domain.de'), ?v7),bif:search_excerpt(bif:vector('domain.de'), ?v6))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . { ?r <http://www.se' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '<' before 'http:' at '' immediately before end of statement)"
Comment 12 Jan 2012-02-24 19:47:25 UTC
Yes, i can confirm this with Kubuntu's 4.8 packages on Oneiric too.
Comment 13 Luis Silva 2012-02-27 14:50:14 UTC
This problem may have been solved with commit 7417d136f00c91b2338440d1a84d1f38f2395484 to akonadi. This commit increases the size of the field that stores sparql queries to 1024 characters. Can people please confirm that this commit fixes the problem for them? It fixes the problem for me if queries are not too complex.
Comment 14 Eric MSP Veith 2012-03-08 11:44:24 UTC
(In reply to comment #13)
> This problem may have been solved with commit
> 7417d136f00c91b2338440d1a84d1f38f2395484 to akonadi. 

It's gone here, too.

However, isn't it possible that there may be another query sometime somewhere, which just exceeds 1024 characters and then the whole thing starts all over again?
Comment 15 Volker Krause 2012-03-11 18:01:29 UTC
Fixed in the commit mentioned in comment #13, available in Akonadi 1.7.1.
Comment 16 Eric MSP Veith 2012-03-15 14:31:46 UTC
I'm sorry to re-post, but I've run into this bug again -- now with a length of > 1024 characters.

The query is:

select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('hilton'), ?v7),bif:search_excerpt(bif:vector('hilton'), ?v8),bif:search_excerpt(bif:vector('hilton'), ?v10),bif:search_excerpt(bif:vector('hilton'), ?v6))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf> <nepomuk:/res/000f022c-8072-420d-842b-3e59781dabca> . { ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#bcc> ?v2 . ?v2 <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#cc> ?v3 . ?v3 <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#to> ?v4 . ?v4 <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasEmailAddress> ?v5 . ?v5 <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#emailAddress> ?v6 . FILTER(bif:contains(?v6, "'hilton'")) . } UNION { ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#messageSubject> ?v7 . FILTER(bif:contains(?v7, "'hilton'")) . } UNION { ?r

It's length is 1025 characters according to |wc -l.

Is it possible to not enforce an upper limit on the queries?
Comment 17 Johannes K. 2012-04-01 10:39:56 UTC
Hi

I get the same error!!

"SQLExecDirect failed on query 'sparql select distinct ?r ?reqProp1 (bif:concat(bif:search_excerpt(bif:vector('Steinmeier'), ?v7),bif:search_excerpt(bif:vector('Steinmeier'), ?v8),bif:search_excerpt(bif:vector('Steinmeier'), ?v10),bif:search_excerpt(bif:vector('Steinmeier'), ?v6))) as ?_n_f_t_m_ex_ where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#isPartOf> <nepomuk:/res/dd94b7bd-a4ea-494f-bc3d-7e087a79c96f> . { ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#bcc> ?v2 . ?v2 <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#cc> ?v3 . ?v3 <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#to> ?v4 . ?v4 <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#hasEmailAddress> ?v5 . ?v5 <http://www.semanticdesktop.org/ontologies/2007/03/22/nco#emailAddress> ?v6 . FILTER(bif:contains(?v6, "'Steinmeier'")) . } UNION { ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#messageSubject> ?v7 . FILTER(bif:contains(?v7, "'Stein' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: Unterminated SPARQL short double-quoted string at '')"