nextcloud / nextcloud/mail

Background sync SSL errors not caught

Open
#8,363 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. to triage bug
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
  1. Have an account with faulty SSL
  2. Run a background sync
Expected behavior

Cron mail sync failed for account 123

Actual behavior

I can't tell which account caused the error:

{
  "reqId": "ygueNZNt088KydR56gGp",
  "level": 3,
  "time": "April 12, 2023 07:36:19",
  "remoteAddr": "",
  "user": "--",
  "app": "PHP",
  "method": "",
  "url": "--",
  "message": "fgets(): SSL: Connection reset by peer at /var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php#156",
  "userAgent": "--",
  "version": "25.0.4.1",
  "exception": {
    "Exception": "Error",
    "Message": "fgets(): SSL: Connection reset by peer at /var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php#156",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket/Connection/Socket.php",
        "line": 156,
        "function": "fgets"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 4541,
        "function": "read",
        "class": "Horde_Imap_Client_Socket_Connection_Socket",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 4313,
        "function": "_getLine",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 4241,
        "function": "_sendCmdChunk",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php",
        "line": 967,
        "function": "_sendCmd",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php",
        "line": 888,
        "function": "_logout",
        "class": "Horde_Imap_Client_Socket",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 466,
        "function": "logout",
        "class": "Horde_Imap_Client_Base",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 235,
        "function": "runPartialSync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php",
        "line": 136,
        "function": "sync",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/mail/lib/BackgroundJob/SyncJob.php",
        "line": 110,
        "function": "syncAccount",
        "class": "OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/Job.php",
        "line": 78,
        "function": "run",
        "class": "OCA\\Mail\\BackgroundJob\\SyncJob",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
        "line": 103,
        "function": "start",
        "class": "OCP\\BackgroundJob\\Job",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/public/BackgroundJob/TimedJob.php",
        "line": 93,
        "function": "start",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      },
      {
        "file": "/var/www/html/cron.php",
        "line": 152,
        "function": "execute",
        "class": "OCP\\BackgroundJob\\TimedJob",
        "type": "->"
      }
    ],
    "File": "/var/www/html/lib/private/Log/ErrorHandler.php",
    "Line": 92,
    "CustomMessage": "--"
  }
}
Mail app version

2.2

Mailserver or service

No response

Operating system

No response

PHP engine version

None

Web server

None

Database

None

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/BackgroundJob/SyncJob.php at syncAccount and follow the calls into lib/Service/Sync/ImapToDbSynchronizer.php, especially the sync and runPartialSync paths shown in the trace. Check how the background sync reports this SSL failure; done means the cron failure identifies the affected account instead of only logging the connection error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.