Re: [exim] exim dies on the interrupted system call

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Tony Finch
Ημερομηνία:  
Προς: Артём Каялайнен
Υ/ο: exim-users, rwatson
Αντικείμενο: Re: [exim] exim dies on the interrupted system call
28.12.2010 5:39, Phil Pennock пишет:
>
> This is a bug in Exim. Looking at the code, I'm rather shocked that
> it has never bitten us before now.
> http://bugs.exim.org/show_bug.cgi?id=1053


I'm not convinced this is correct, since at the point in the code
where the panic occurs, Exim believes it is writing to a disk file and
short writes should not occur.

Artem, can you reproduce the bug when running Exim under ktrace -di and/or
with the patch to log.c below? The st_mode value might tell us something
interesting.

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}



--- log.c    6 Jun 2010 00:27:52 -0000
+++ log.c    5 Jan 2011 18:51:13 -0000
@@ -886,8 +891,19 @@


     if ((rc = write(mainlogfd, log_buffer, length)) != length)
       {
-      log_write_failed(US"main log", length, rc);
-      /* That function does not return */
+      int save_errno = errno;
+
+      if (panic_save_buffer == NULL)
+        {
+        panic_save_buffer = (uschar *)malloc(LOG_BUFFER_SIZE);
+        if (panic_save_buffer != NULL)
+          memcpy(panic_save_buffer, log_buffer, LOG_BUFFER_SIZE);
+        }
+
+      log_write(0, LOG_PANIC_DIE, "failed to write to %s: length=%d result=%d "
+        "errno=%d (%s) st_mode=%x", name, length, rc, save_errno,
+        (save_errno == 0)? "write incomplete" : strerror(save_errno), statbuf.st_mode);
+      /* Never returns */
       }
     }
   }