[EXIM] 2.05 small bug

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Philip Hazel
Fecha:  
A: exim-users
Asunto: [EXIM] 2.05 small bug
It is clearly a day for posting patches. A small bug has surfaced in
Exim 2.05. If, on an incoming SMTP connection, a message gets queued
rather than immediately delivered because either (a) there are too many
messages coming in on one connection (smtp_accept_queue_per_connection)
or (b) the load average is high (queue_only_load), then this incident is
correctly logged. However, if there are further messages on the same
connection, they get (correctly) queued, but the log message states
(incorrectly) that there are too many incoming connections.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.



*** exim-2.05/src/daemon.c  Thu Oct  8 11:00:08 1998
--- src/daemon.c    Wed Oct 14 10:50:25 1998
***************
*** 275,280 ****
--- 278,284 ----
    {
    int i;
    int message_count = 0;
+   int queue_only_reason = 0;
    BOOL local_queue_only = queue_only;


    /* Close the listening sockets, and set the SIGCHLD handler to SIG_IGN.
***************
*** 305,311 ****
--- 309,318 ----
    till later so it will have a message id attached. */


    if (smtp_accept_queue > 0 && smtp_accept_count >= smtp_accept_queue)
+     {
      local_queue_only = TRUE;
+     queue_only_reason = 1;
+     }


    /* Handle the start of the SMTP session, then loop, accepting incoming
    messages from the SMTP connection. The end will come at the QUIT command,
***************
*** 383,412 ****
            ++message_count > smtp_accept_queue_per_connection)
          {
          local_queue_only = TRUE;
!         log_write(4, LOG_MAIN, "no immediate delivery: more than %d messages "
!           "received in one connection\n", smtp_accept_queue_per_connection);
          }
        else if (queue_only_load >= 0)
          {
          local_queue_only = (load_average = os_getloadavg()) > queue_only_load;
!         if (local_queue_only)
!           log_write(4, LOG_MAIN, "no immediate delivery: load average = %.2f\n",
!             (double)load_average/1000.0);
          }
        }


      /* Log the queueing here, when it will get a message id attached, but
!     not if queue_only is set. */


!     else if (!queue_only) log_write(4, LOG_MAIN,
!       "no immediate delivery: too many connections (%d, max %d)\n",
!         smtp_accept_count, smtp_accept_queue);


      /* If a delivery attempt is required, spin off a new process to handle it.
      If we are not root, we have to re-exec exim unless root can be regained by
      the use of seteuid. */


!     if (!local_queue_only && (pid = fork()) == 0)
        {
        fclose(smtp_in);
        fclose(smtp_out);
--- 390,430 ----
            ++message_count > smtp_accept_queue_per_connection)
          {
          local_queue_only = TRUE;
!         queue_only_reason = 2;
          }
        else if (queue_only_load >= 0)
          {
          local_queue_only = (load_average = os_getloadavg()) > queue_only_load;
!         if (local_queue_only) queue_only_reason = 3;
          }
        }


      /* Log the queueing here, when it will get a message id attached, but
!     not if queue_only is set (case 0). */


!     if (local_queue_only) switch(queue_only_reason)
!       {
!       case 1:
!       log_write(4, LOG_MAIN, "no immediate delivery: too many connections "
!         "(%d, max %d)\n", smtp_accept_count, smtp_accept_queue);
!       break;


+       case 2:
+       log_write(4, LOG_MAIN, "no immediate delivery: more than %d messages "
+         "received in one connection", smtp_accept_queue_per_connection);
+       break;
+ 
+       case 3:
+       log_write(4, LOG_MAIN, "no immediate delivery: load average was %.2f\n",
+         (double)load_average/1000.0);
+       break;
+       }
+ 
      /* If a delivery attempt is required, spin off a new process to handle it.
      If we are not root, we have to re-exec exim unless root can be regained by
      the use of seteuid. */


!     else if ((pid = fork()) == 0)
        {
        fclose(smtp_in);
        fclose(smtp_out);


*** exim-2.05/src/exim.c    Thu Oct  8 11:00:09 1998
--- src/exim.c        Wed Oct 14 10:50:25 1998
***************
*** 233,238 ****
--- 235,241 ----
  int  msg_action = 0;
  int  msg_action_arg = -1;
  int  namelen = (argv[0] == NULL)? 0 : (int)strlen(argv[0]);
+ int  queue_only_reason = 0;
  int  recipients_arg = argc;
  int  sender_address_domain = 0;
  int  test_retry_arg = -1;
***************
*** 2751,2770 ****
          ++message_count > smtp_accept_queue_per_connection)
        {
        local_queue_only = TRUE;
!         log_write(4, LOG_MAIN, "no immediate delivery: more than %d messages "
!           "received in one connection\n", smtp_accept_queue_per_connection);
        }
      else if (queue_only_load >= 0)
        {
        local_queue_only = (load_average = os_getloadavg()) > queue_only_load;
!       if (local_queue_only)
!         log_write(4, LOG_MAIN, "no immediate delivery: load average = %.2f\n",
!           (double)load_average/1000.0);
        }
      }


!   if (!local_queue_only)
      {
      /* If running as root, or if we can regain root by seteuid, or this binary
      is not setuid to root (an exceptional case) call the delivery function
      directly for synchronous delivery, or fork a clone of this process to
--- 2754,2789 ----
          ++message_count > smtp_accept_queue_per_connection)
        {
        local_queue_only = TRUE;
!       queue_only_reason = 2;
        }
      else if (queue_only_load >= 0)
        {
        local_queue_only = (load_average = os_getloadavg()) > queue_only_load;
!       if (local_queue_only) queue_only_reason = 3;
        }
      }


!   /* Log the queueing here, when it will get a message id attached, but
!   not if queue_only is set (case 0). Case 1 doesn't happen here (too many
!   connections). */
! 
!   if (local_queue_only) switch(queue_only_reason)
      {
+     case 2:
+     log_write(4, LOG_MAIN, "no immediate delivery: more than %d messages "
+       "received in one connection", smtp_accept_queue_per_connection);
+     break;
+ 
+     case 3:
+     log_write(4, LOG_MAIN, "no immediate delivery: load average was %.2f\n",
+       (double)load_average/1000.0);
+     break;
+     }
+ 
+   /* Else do the delivery */
+ 
+   else
+     {
      /* If running as root, or if we can regain root by seteuid, or this binary
      is not setuid to root (an exceptional case) call the delivery function
      directly for synchronous delivery, or fork a clone of this process to



--
*** Exim information can be found at http://www.exim.org/ ***