[Pkg-roundcube-maintainers] Bug#947320: roundcube-core: Retry to connect to IMAP server

Sandro Knauß hefee at debian.org
Tue Dec 24 16:21:40 GMT 2019


Package: roundcube-core
Version: 1.3.8+dfsg.1-2
Severity: important
Tags: patch

Hey,

An IMAP server may have temporally issues, like to much load and roundcube fails with
"Empty startup gretting".

Hefee


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'oldstable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.3.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages roundcube-core depends on:
ii  dbconfig-common                                 2.0.13
ii  debconf [debconf-2.0]                           1.5.73
ii  dpkg                                            1.19.7
ii  libapache2-mod-php                              2:7.3+69
ii  libapache2-mod-php7.3 [libapache2-mod-php]      7.3.12-1
pn  libjs-bootstrap4                                <none>
ii  libjs-codemirror                                5.49.2-1
ii  libjs-jquery                                    3.3.1~dfsg-3
pn  libjs-jquery-minicolors                         <none>
ii  libjs-jquery-ui                                 1.12.1+dfsg-5
pn  libjs-jstimezonedetect                          <none>
ii  libmagic1                                       1:5.37-6
pn  php-auth-sasl                                   <none>
ii  php-cli                                         2:7.3+69
ii  php-common                                      2:69
pn  php-intl                                        <none>
pn  php-mail-mime                                   <none>
pn  php-masterminds-html5                           <none>
pn  php-mbstring                                    <none>
pn  php-mcrypt                                      <none>
pn  php-net-sieve                                   <none>
pn  php-net-smtp                                    <none>
pn  php-net-socket                                  <none>
ii  php-pear                                        1:1.10.9+submodules+notgz-1
ii  php7.0-cli [php-cli]                            7.0.33-0+deb9u6
ii  php7.0-json [php-json]                          7.0.33-0+deb9u6
ii  php7.2-cli [php-cli]                            7.2.9-1
ii  php7.2-json [php-json]                          7.2.9-1
ii  php7.3-cli [php-cli]                            7.3.12-1
ii  php7.3-json [php-json]                          7.3.12-1
pn  roundcube-mysql | roundcube-sqlite3 | roundcub  <none>
ii  ucf                                             3.0038+nmu1

Versions of packages roundcube-core recommends:
ii  apache2 [httpd-cgi]  2.4.41-1
pn  php-gd               <none>
pn  php-pspell           <none>

Versions of packages roundcube-core suggests:
pn  php-crypt-gpg             <none>
pn  php-mkopinsky-zxcvbn-php  <none>
pn  php-net-ldap2             <none>
pn  php-net-ldap3             <none>
pn  roundcube-plugins         <none>
-------------- next part --------------
Description: Retries to connect to IMAP server.
  As it may happen, that an IMAP server will have temporally issues and answers
  with "Empty startup greeting".
Author: Hefee <hefee at debian.org>
Last-Update: 2019-12-24

---
--- a/program/lib/Roundcube/rcube_imap.php
+++ b/program/lib/Roundcube/rcube_imap.php
@@ -144,7 +144,11 @@ class rcube_imap extends rcube_storage
 
         $attempt = 0;
         do {
-            $data = $this->plugins->exec_hook('storage_connect',
+                if ($attempt > 0) {
+                    usleep(rand(1000, 100000));
+                }
+                rcube::write_log('imap','Connecting to IMAP server attempt:'.$attempt);
+                $data = $this->plugins->exec_hook('storage_connect',
                 array_merge($this->options, array('host' => $host, 'user' => $user,
                     'attempt' => ++$attempt)));
 
@@ -156,7 +160,7 @@ class rcube_imap extends rcube_storage
             rcube_utils::parse_socket_options($data['socket_options'], $data['host']);
 
             $this->conn->connect($data['host'], $data['user'], $pass, $data);
-        } while(!$this->conn->connected() && $data['retry']);
+        } while(!$this->conn->connected() && $data['attempt'] < 6);
 
         $config = array(
             'host'     => $data['host'],


More information about the Pkg-roundcube-maintainers mailing list