Hi Will, Volker,
attached you will find a Soprano patch. This patch does not solve the
timeout problem (I do not understand that yet). But it works around the
problem of the invalid command. Soprano does not recover from the
timeout. Thus, this patch simply forces a reconnect.
Can you please test it and see if it works, ie. if it recovers from the
timeout?
Cheers,
Sebastian
On 12/19/2010 10:56 AM, Volker Krause wrote:
> On Tuesday 07 December 2010 17:10:29 Will Stephenson wrote:
>> I frequently see the following behaviour from nepomuk_email_feeder.
>>
>> *)Trunk from today, soprano 2.5.63, virtuoso 6.1.2
>>
>> *) High CPU usage
>>
>> *) console output, repeated forever
>> local socket error: QLocalSocket::PeerClosedError
>> "/space/kde/installs/trunk/bin/akonadi_nepomuk_email_feeder(5719)" Soprano:
>> "Command timed out."
>> "/space/kde/installs/trunk/bin/akonadi_nepomuk_email_feeder(5719)" Soprano:
>> "Invalid model id"
>> "/space/kde/installs/trunk/bin/akonadi_nepomuk_email_feeder(5719)" Soprano:
>> "Invalid iterator."
>>
>> * console output from nepomuk, repeated forever
>> [/space/kde/installs/trunk/bin/nepomukservicestub] Unknown command: 212
>> closing connection
>> [/space/kde/installs/trunk/bin/nepomukservicestub] virtual void
>> Soprano::Server::LocalServer::incomingConnection(quintptr)
>> [/space/kde/installs/trunk/bin/nepomukservicestub] void
>> Soprano::Server::ServerCorePrivate::addConnection(Soprano::Server::ServerCo
>> nnection*) New connection. New count: 14
>> [/space/kde/installs/trunk/bin/nepomukservicestub] virtual void
>> Soprano::Server::ServerConnection::run() thread done.
>> [/space/kde/installs/trunk/bin/nepomukservicestub] void
>> Soprano::Server::ServerCore::serverConnectionFinished()
>> [/space/kde/installs/trunk/bin/nepomukservicestub] virtual
>> Soprano::Server::ServerConnection::~ServerConnection() Removing connection
>> [/space/kde/installs/trunk/bin/nepomukservicestub] void
>> Soprano::Server::ServerCore::serverConnectionFinished() Connection removed.
>> Current count: 13
>>
>> It seems that Soprano hangs up the connection after receiving the unknown
>> 212 and then the feeder continues to try the same command.
>>
>> Is this a bug (which I will report) or a local/packaging error? Does
>> soprano even use numeric command codes?
>
> I looked into this a bit yesterday and here are my findings:
>
> 1) After a clean restart of Nepomuk and the mail feeder everything works fine
> for 30-60 seconds. Every Soprano operation takes a few milliseconds and a
> whole bunch of emails are getting indexed during that phase. Akonadi and
> Nepomuk components use all available CPU at this point, which is perfectly
> fine and expected IMHO.
>
> 2) For no apparent reason closing the query result iterator in the feeder
> agent (kdepim/nepomuk_email_feeder/shared/nepomukfeederagentbase.cpp:441)
> suddenly takes 15 seconds. I followed this down to the
> Soprano::ODBC::QueryResult dtor.where it ends in raw ODBC commands:
> SQLCloseCursor( d->m_hstmt );
> SQLFreeHandle( SQL_HANDLE_STMT, d->m_hstmt );
> All other Soprano operations behave like before, taking only a few
> milliseconds each. Virtuoso is basically the only thing using CPU at this
> point. Since it takes 15 seconds exactly all the time, I'd suspect this to be
> some kind of timeout.
>
> 3) If you leave it running further, you'll eventually end up in the state
> Will
> described. It does not seem to recover by itself from that.
>
> regards
> Volker
>
>
>
> _______________________________________________
> Nepomuk mailing list
> [email protected]
> https://mail.kde.org/mailman/listinfo/nepomuk
diff --git a/client/clientconnection.cpp b/client/clientconnection.cpp
index ab70616..8f6045a 100644
--- a/client/clientconnection.cpp
+++ b/client/clientconnection.cpp
@@ -114,7 +114,9 @@ int Soprano::Client::ClientConnection::createModel( const
QString& name, const Q
Q_UNUSED( settings );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -143,7 +145,9 @@ void Soprano::Client::ClientConnection::removeModel( const
QString& name )
stream.writeString( name );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return;
}
@@ -168,7 +172,9 @@ Soprano::BackendFeatures
Soprano::Client::ClientConnection::supportedFeatures()
stream.writeUnsignedInt16( COMMAND_SUPPORTED_FEATURES );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -198,7 +204,9 @@ Soprano::Error::ErrorCode
Soprano::Client::ClientConnection::addStatement( int m
stream.writeStatement( statement );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Error::ErrorUnknown;
}
@@ -226,7 +234,9 @@ int Soprano::Client::ClientConnection::listContexts( int
modelId )
stream.writeUnsignedInt32( ( quint32 )modelId );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -257,7 +267,9 @@ int Soprano::Client::ClientConnection::executeQuery( int
modelId, const QString
stream.writeString( userQueryLanguage );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -286,7 +298,9 @@ int Soprano::Client::ClientConnection::listStatements( int
modelId, const Statem
stream.writeStatement( partial );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -315,7 +329,9 @@ Soprano::Error::ErrorCode
Soprano::Client::ClientConnection::removeAllStatements
stream.writeStatement( statement );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Error::ErrorUnknown;
}
@@ -344,7 +360,9 @@ Soprano::Error::ErrorCode
Soprano::Client::ClientConnection::removeStatement( in
stream.writeStatement( statement );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Error::ErrorUnknown;
}
@@ -372,7 +390,9 @@ int Soprano::Client::ClientConnection::statementCount( int
modelId )
stream.writeUnsignedInt32( ( quint32 )modelId );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return -1;
}
@@ -401,7 +421,9 @@ bool Soprano::Client::ClientConnection::containsStatement(
int modelId, const St
stream.writeStatement( statement );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
@@ -430,7 +452,9 @@ bool
Soprano::Client::ClientConnection::containsAnyStatement( int modelId, const
stream.writeStatement( statement );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
@@ -458,7 +482,9 @@ bool Soprano::Client::ClientConnection::isEmpty( int
modelId )
stream.writeUnsignedInt32( ( quint32 )modelId );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
@@ -486,7 +512,9 @@ Soprano::Node
Soprano::Client::ClientConnection::createBlankNode( int modelId )
stream.writeUnsignedInt32( ( quint32 )modelId );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Node();
}
@@ -514,7 +542,9 @@ bool Soprano::Client::ClientConnection::iteratorNext( int
id )
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
@@ -542,7 +572,9 @@ Soprano::Node
Soprano::Client::ClientConnection::nodeIteratorCurrent( int id )
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Node();
}
@@ -570,7 +602,9 @@ Soprano::Statement
Soprano::Client::ClientConnection::statementIteratorCurrent(
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Statement();
}
@@ -598,7 +632,9 @@ Soprano::BindingSet
Soprano::Client::ClientConnection::queryIteratorCurrent( int
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return BindingSet();
}
@@ -626,7 +662,9 @@ Soprano::Statement
Soprano::Client::ClientConnection::queryIteratorCurrentStatem
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return Statement();
}
@@ -653,7 +691,9 @@ int Soprano::Client::ClientConnection::queryIteratorType(
int id )
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return 0;
}
@@ -681,7 +721,9 @@ bool
Soprano::Client::ClientConnection::queryIteratorBoolValue( int id )
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
@@ -708,7 +750,9 @@ void Soprano::Client::ClientConnection::iteratorClose( int
id )
stream.writeUnsignedInt32( ( quint32 )id );
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return;
}
@@ -732,7 +776,9 @@ bool
Soprano::Client::ClientConnection::checkProtocolVersion()
// wait for a reply, but not forever, in case we are connected to
something unknown
if ( !socket->waitForReadyRead(s_defaultTimeout) ) {
- setError( "Command timed out." );
+ setError( "Command timed out.", Soprano::Error::ErrorTimeout );
+ // We cannot recover from a timeout, thus we force a reconnect
+ socket->close();
return false;
}
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk