Virtuoso going crazy?

There have been cases of virtuoso going a little crazy and consuming a lot of CPU cycles. It’s extremely frustrating. However, it’s ever more annoying when you have no idea what’s wrong.

Most of bug reports we get just say that virtuoso is consuming too much CPU, and that isn’t the least bit helpful. So, here is a short guide to figure out what query is causing virtuoso to go crazy.

Listing Queries

Nepomuk contains a query service which is used to cache queries and to execute them asynchronously. We can use it at any point to figure out which all queries are being executed.

$ qdbus

Each of the /nepomukqueryservice/query[n] represents one query.

Getting the SPARQL Query

$ qdbus
/nepomukqueryservice/query4 queryString

And you’ll get something like this -

select distinct ?r ?v2 where { { ?r a
<> . ?r
<> ?v2 . }
. ?r <>
?v1 . FILTER(?v1>0) . } ORDER BY DESC ( ?v2 )

This query is extrememly important cause without it finding the cause is nearly impossible.

Killing queries

$ qdbus /nepomukqueryservice/query4 close

This will end the query

When/If you find virtuoso consuming too much cpu, list out all the queries and close each of them one by one. The moment virtuoso gets better, you’ll have your culprit.

That’s the query you should post in the bug report.