Open triton3 opened 6 years ago
Does mailcore disconnect the IMAPSession when IDLE operation is terminated?
I am still facing this issue intermittently. Please see code below. It crashes when idle operation is started. As you can see, I am creating a new session for the Idle operation.
// always create a new session for IDLE
let newSession = MCOIMAPSession().with(carrierSettings: self.carrier)
self.session = newSession
let hostname = self.session?.hostname ?? ""
self.idleOperation = newSession.idleOperation(withFolder: self.folderPath, lastKnownUID: self.lastCheckedUID.uint32Value)
Log.Debug("ImapIdleConnection::\(#line): ============================================================================")
Log.Debug("ImapIdleConnection::\(#line): Starting IDLE connection to \(self.folderPath) folder on \(hostname) with last known UID \(self.lastCheckedUID)...")
Log.Debug("ImapIdleConnection::\(#line): ============================================================================")
// start idle op
self.idleOperation?.start {[weak self] (error: Error?) in
....
}
Here is the log output:
2018-08-03 13:02:26.100159-0400 App[28207:1129567] ImapIdleConnection::122: ============================================================================
2018-08-03 13:02:26.100137-0400 App[28207:1129567] ImapIdleConnection::123: Starting IDLE connection to <private> folder on <private> with last known UID 0...
2018-08-03 13:02:26.100139-0400 App[28207:1160900] ImapIdleConnection::124: ============================================================================
~/mailcore2-master/src/core/imap/MCIMAPSession.cpp:612: assert mImap == NULL
I think the IMAPSession disconnect after 30 sec when operations are terminated. That said, it shouldn't lead to this crash. It should reconnect automatically. Are you trying to use MCOIMAPSession from several threads?
Could you show a full minimal app example so that I can repro?
@dinhviethoa Thank you for your response.
Could you show a full minimal app example so that I can repro?
The problem is that it is not easily/reliably reproducible (happens once in several weeks when the app has been left running).
I think the IMAPSession disconnect after 30 sec when operations are terminated. That said, it shouldn't lead to this crash. It should reconnect automatically. Are you trying to use MCOIMAPSession from several threads?
Hmm. I always disconnect an existing connection before creating a new one for idle. But I now wonder about the threading issue with the session. Once I create the session for Idle it is not used by any other operation, but thanks for the hint. I will investigate if that is happening as a corner case.
This is an intermittent crash with IDLE operation on macOS we have been observing, when our app is running over several days continuously (a couple of weeks or more). See crash report below:
It looks like
mImap
property inIMAPSession
is notNULL
but the assert condition expects it to benull
, and the assert is causing the crash.We are attempting to debug this, but given that this is sporadic, it is not easy to reproduce.
Question: What is the scenario in which
mImap
property should beNULL
? Any help/hints to resolve this would be greatly appreciated.