[Tracker] Fwd: Tracker closing the databse



Think i have replied only to Martin.

This the code that causes the problems.

Regards,
Ionut

---------- Forwarded message ----------
From: Putinei .Ionut <putineiionut gmail com>
Date: Fri, Jul 5, 2013 at 10:06 AM
Subject: Re: [Tracker] Tracker closing the databse
To: Martyn Russell <martyn lanedo com>


The TrackerSparqlConnection is left open since is a class member and is closed in destructor.
TrackerSparqlCursor is unrefed.

Here i am about to execute a banch of queries.....but i am not interested in results....i am only interested if query has any results
bool TestClass::ExecuteBatchQuery(std::vector<std::string> &queries,std::vector<bool>* queryResponseCount){
    TrackerSparqlConnection *trackerConnection = getTrackerConnection(); // here we get the connection and we assign it to a class member...further calls to this will return the class member
    if (trackerConnection == NULL) {
        return false;
    }
    for (int i=0;i<queries.size();++i){

        GError* error = NULL;
        TrackerSparqlCursor* cursor = tracker_sparql_connection_query(trackerConnection, queries.at(i).c_str(), NULL, &error);
        if (error) {
            queryResponseCount->push_back(false);
            g_error_free (error);
            continue;
        }

        if (cursor == NULL) {
            queryResponseCount->push_back(false);
            continue;
        } else {
            int cursorcount=0;
            while (tracker_sparql_cursor_next(cursor, NULL, &error)) {
                if (error)
                    break;
                cursorcount++;
                break;
            }

            if(cursorcount)
                queryResponseCount->push_back(true);
            else
                queryResponseCount->push_back(false);
           

        g_object_unref(cursor);
    }
    }
    return true;
}


On Thu, Jul 4, 2013 at 11:02 PM, Martyn Russell <martyn lanedo com> wrote:
On 07/03/2013 02:43 PM, Putinei .Ionut wrote:
Hello,

Hello,

I run a  bunch for queries with tracker_sparql_connection_query(sync
version).....with same TrackerSparqlConnection.

After 40-50 queries my app hangs.

I see in tracker log that about the same time tracker is closing the
sqlite database.

Do you have any advice for this issue?Could the fact that tracker is
closing database i get the hang?

Are you able to share the code with us?

I suspect you have references open to one or more TrackerSparqlCursor objects, though it's hard to tell without looking at the code.


Why is the reason to close the database.....since i have seen in code
that close is done in "tracker_db_interface_sqlite_finalize" that is
seem like a destructor function GObject TrackerDBInterface.

Usually, if you unref and finish with the connection we clean up yes.
If you're not expecting this it could be related. Again, sharing the code would go a long way to help us help you figure out what might be the problem.

Thanks,

--
Regards,
Martyn

Founder and CEO of Lanedo GmbH.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]