Skip to content

Prevent deadlock in IMAPServer.close when using 'maxsyncaccounts' and 'maxconnections'.#241

Open
altruizine wants to merge 1 commit intoOfflineIMAP:masterfrom
altruizine:upstream-deadlock-fix
Open

Prevent deadlock in IMAPServer.close when using 'maxsyncaccounts' and 'maxconnections'.#241
altruizine wants to merge 1 commit intoOfflineIMAP:masterfrom
altruizine:upstream-deadlock-fix

Conversation

@altruizine
Copy link
Copy Markdown
Contributor

We introduce a separate closing flag that's checked in acquireconnection, decoupling the connectionlock from the semaphore such that they can be acquired separately.

This is work towards getting rid of the 'maxsyncaccounts' / 'maxconnections' deprecation warning in the manual.

This PR

  • I've read the DCO.
  • I've read the Coding Guidelines
  • The relevant informations about the changes stands in the commit message, not here in the message of the pull request.
  • Code changes follow the style of the files they change.
  • Code is tested (details below).

References

Additional information

I'm using this change in production with 'maxsyncaccounts' and 'maxconnections' both set to values > 1, as well as with autorefresh set. This change allows recovery from connection hangs after network changes (such as resuming after system suspend).

… 'maxconnections'.

We introduce a separate closing flag that's checked in
acquireconnection, decoupling the connectionlock from the semaphore
such that they can be acquired separately.

Signed-off-by: Michael Hohmuth <hohmuth@sax.de>
@thekix
Copy link
Copy Markdown
Member

thekix commented Apr 25, 2026

PR to testing. Please, check it :-)

Thanks!

@altruizine
Copy link
Copy Markdown
Contributor Author

I'll run the testing branch for a day or two and report back. Thanks!

@altruizine
Copy link
Copy Markdown
Contributor Author

The fix works fine on the testing branch but surfaces an issue with the new mechanism that attempts to fix unhealthy sockets. I'm proposing a new solution (tested, works for me) in #243.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants