Page MenuHomePhorge

Interval sync of imap resource doesn't work.
Closed, ResolvedPublic5 Story Points

Description

Just tried again, the invitation doesn't appear without manual intervention, and the event is not visible with akonadiconsole, but can immediately be synced with akonadiconsole.
Note this is the regular calendar folder, NOT inbox (which has IDLE).

Details

Ticket Type
Task

Event Timeline

mollekopf raised the priority of this task from 40 to 60.Jun 6 2016, 6:04 PM
mollekopf created this task.
mollekopf raised the priority of this task from 60 to High.

https://issues.kolab.org/show_bug.cgi?id=5443

It apparently does work sometimes, but not reliably.

We don't know what part of the stack doesn't update reliably (it could be the sync, but it could also be something different so we don't see the event in the calendar).

Resuming timer timer:
Starting timer:  QDateTime("Wed Jun 22 16:10:51 2016") 300000
IntervalCheck, collectionExpired:  24
Resuming timer timer:

.... a bit later
 Resuming timer timer:                                                                                                                                                                                                                                     
Starting timer:  QDateTime("Wed Jun 22 16:10:52 2016") 300000                                                                                                                                                                                             
kontact(1430)/korganizer ActionManager::updateConfig:                                                                                                                                                                                                     
kontact(1430)/korganizer ActionManager::updateConfig: 
IntervalCheck, collectionExpired:  24                                                                                                                                                                                                                     
  Already checked, not checking again:  24 QDateTime("Wed Jun 22 16:10:51 2016") QDateTime("Wed Jun 22 16:05:52 2016")                                                                                                                                      
 Resuming timer timer:   


.... a bit later:
Scheduler timeout, collection:  24                                                                                                                                                                                                                        
 IntervalCheck, collectionExpired:  24                                                                                                                                                                                                                     
Already checked, not checking again:  24 QDateTime("Wed Jun 22 16:10:51 2016") QDateTime("Wed Jun 22 16:10:50 2016")                                                                                                                                      
Expiry minutes:  24 5   
...
Starting timer:  QDateTime("Wed Jun 22 16:15:50 2016") 300000

where the debug output refers to:

65 void IntervalCheck::collectionExpired( const Collection &collection )                                                                                                                                                                                    
   66 {                                                                                                                                                                                                                                                        
+  67   qDebug() << "IntervalCheck, collectionExpired: " << collection.id();                                                                                                                                                                                   
   68   const QDateTime now( QDateTime::currentDateTime() );                                                                                                                                                                                                   
   69                                                                                                                                                                                                                                                          
   70   if ( collection.parentId() == 0 ) {                                                                                                                                                                                                                    
   71     const QString resourceName = collection.resource().name();                                                                                                                                                                                           
   72                                                                                                                                                                                                                                                          
   73     const int interval = qMax( MINIMUM_COLTREESYNC_INTERVAL, collection.cachePolicyCheckInterval() );                                                                                                                                                    
   74                                                                                                                                                                                                                                                          
   75     const QDateTime lastExpectedCheck = now.addSecs( interval * -60 );                                                                                                                                                                                   
   76     if ( !mLastCollectionTreeSyncs.contains( resourceName ) || mLastCollectionTreeSyncs.value( resourceName ) < lastExpectedCheck ) {                                                                                                                    
   77       mLastCollectionTreeSyncs.insert( resourceName, now );                                                                                                                                                                                              
   78       QMetaObject::invokeMethod( ItemRetrievalManager::instance(), "triggerCollectionTreeSync",                                                                                                                                                          
   79                                  Qt::QueuedConnection,                                                                                                                                                                                                   
   80                                  Q_ARG( QString, resourceName ) );                                                                                                                                                                                       
   81     }                                                                                                                                                                                                                                                    
   82   }                                                                                                                                                                                                                                                      
   83                                                                                                                                                                                                                                                          
   84   // now on to the actual collection syncing                                                                                                                                                                                                             
   85   const int interval = qMax( MINIMUM_AUTOSYNC_INTERVAL, collection.cachePolicyCheckInterval() );                                                                                                                                                         
   86                                                                                                                                                                                                                                                          
   87   const QDateTime lastExpectedCheck = now.addSecs( interval * -60 );                                                                                                                                                                                     
   88   if ( mLastChecks.contains( collection.id() ) && mLastChecks.value( collection.id() ) > lastExpectedCheck ) {                                                                                                                                           
+  89     qDebug() << "Already checked, not checking again: " << collection.id() << mLastChecks.value( collection.id() ) <<  lastExpectedCheck;                                                                                                                
   90     return;                                                                                                                                                                                                                                              
   91   }                                                                                                                                                                                                                                                      
   92   mLastChecks.insert( collection.id(), now );
 void start( int interval )                                                                                                                                                                                                                           
   45     {                                                                                                                                                                                                                                                    
   46       mStarted = QDateTime::currentDateTime();                                                                                                                                                                                                           
   47       mPaused = QDateTime();                                                                                                                                                                                                                             
+  48       qWarning() << "Starting timer: " << mStarted << interval;                                                                                                                                                                                          
   49       setInterval( interval );                                                                                                                                                                                                                           
   50       QTimer::start( interval );                                                                                                                                                                                                                         
   51     }       

 void stop()                                                                                                                                                                                                                                          
   59     {                                                                                                                                                                                                                                                    
+  60       qWarning() << "Stopping timer: ";                                                                                                                                                                                                                  
   61       mStarted = QDateTime();                                                                                                                                                                                                                            
   62       mPaused = QDateTime();                                                                                                                                                                                                                             
   63       QTimer::stop();                                                                                                                                                                                                                                    
   64     }     
               
  void resume()                                                                                                                                                                                                                                        
   82     {                                                                                                                                                                                                                                                    
   83       if ( !isPaused() ) {                                                                                                                                                                                                                               
   84         akError() << "Cannot resume a timer that is not paused.";                                                                                                                                                                                        
   85         return;                                                                                                                                                                                                                                          
   86       }                                                                                                                                                                                                                                                  
   87                                                                                                                                                                                                                                                          
+  88       qWarning() << "Resuming timer timer: ";                                                                                                                                                                                                            
   89       start( qMax(0, interval() - ( mStarted.secsTo( mPaused ) * 1000 )) );                                                                                                                                                                              
   90       mPaused = QDateTime();                                                                                                                                                                                                                             
   91       // Update mStarted so that pause() can be called repeatedly                                                                                                                                                                                        
   92       mStarted = QDateTime::currentDateTime();                                                                                                                                                                                                           
   93     }

This looks like mLastChecks contains a too recent timestamp, causing a few updates to be skipped. Also the second time it's only by 1 second, so that looks suspicious.

That was after changing the interval and restarting akonadi

It shouldn't be possible that mLastChecks contains something too recent since it's initialized from currentDateTime()....

mollekopf set the point value for this task to 5.Jun 27 2016, 11:39 AM

We sometimes missed sync intervals, and failed to synchronize collections that are only referenced, but not enabled.

mollekopf lowered the priority of this task from High to 40.Jun 28 2016, 9:56 AM
mollekopf moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
mollekopf moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Jul 27 2016, 3:17 PM
mollekopf moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Sep 27 2016, 10:29 AM