unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Josefsson <jas@extundo.com>
Cc: emacs-devel@gnu.org, rms@gnu.org
Subject: Re: [cc@ivu-ac.de: Re: Problem sending bigger mails with CVS Gnus + CVS Emacs]
Date: Sun, 19 May 2002 02:07:50 +0200	[thread overview]
Message-ID: <ilu661l2e5l.fsf@latte.josefsson.org> (raw)
In-Reply-To: <200205181849.g4IInZx22152@aztec.santafe.edu> (Richard Stallman's message of "Sat, 18 May 2002 12:49:35 -0600 (MDT)")

This bug might be related to the "deadlock" workarounds in Gnus --
whenever lots of data is sent, it calls `accept-process-output' once
in a while to prevent deadlocks (see e.g. nntp.el, search for "dead").
However, I'm often sending multi-MB mail using smtpmail.el, so I
suspect it is a subtle bug (I'm using redhat, the reporter is using
windows).

Christoph, can you try this patch instead of your defadvice?

Also, please frob smtpmail-debug-info to non-nil and mail the contents
in the *trace of SMTP session to server* buffer after sending a large
mail.

smtpmail.el is not very nicely coded, it calls process-send-* in lots
of places without first checking if the process is still alive.  So if
the connection is dropped or similar, the code will always cause the
elisp error you got.

--- smtpmail.el.~1.44.~	Tue May 14 23:56:46 2002
+++ smtpmail.el	Sun May 19 02:01:50 2002
@@ -832,10 +832,12 @@
   (setq smtpmail-read-point (point))
   ;; Escape "." at start of a line
   (if (eq (string-to-char data) ?.)
-      (process-send-string process "."))
-  (process-send-string process data)
-  (process-send-string process "\r\n")
-  )
+      (when (memq (process-status process) '(open run))
+	(process-send-string process ".")))
+  (when (memq (process-status process) '(open run))
+    (process-send-string process data))
+  (when (memq (process-status process) '(open run))
+    (process-send-string process "\r\n")))
 
 (defun smtpmail-send-data (process buffer)
   (let
@@ -847,7 +849,8 @@
     (with-current-buffer buffer
       (goto-char (point-min)))
 
-    (while data-continue
+    (while (and data-continue
+		(memq (process-status process) '(open run)))
       (with-current-buffer buffer
 	(beginning-of-line)
 	(setq this-line (point))
@@ -859,6 +862,7 @@
 	    (setq data-continue nil)))
 
       (smtpmail-send-data-1 process sending-data)
+      (accept-process-output process 0)
       )
     )
   )


Richard Stallman <rms@gnu.org> writes:

> Can you do the right thing about this?  Or if it is due to a problem
> in Emacs primitives, could you explain the problem to us so someone
> can try to fix it?
>
> From: Christoph Conrad <cc@ivu-ac.de>
> Subject: Re: Problem sending bigger mails with CVS Gnus + CVS Emacs
> To: emacs-pretest-bug@gnu.org
> Date: Fri, 17 May 2002 15:50:13 +0200
> Reply-to: cc@ivu-ac.de, christoph.conrad@gmx.de
> Organization: Church of GNU Emacs
>
> In GNU Emacs 21.2.50.1 (i386-msvc-nt4.0.1381)
>  of 2002-05-17 on CLI119
> configured using `configure --with-msvc (12.00)'
> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: DEU
>   locale-coding-system: iso-latin-1
>   default-enable-multibyte-characters: nil
>
> I have some strange problem (and a workaround) with CVS Gnus and CVS
> Emacs, both from today.
>
> When i try to send a mail which is a little bit bigger than about 40K
> the following lines are in /var/log/mail
>
> ,----
> | May 17 13:14:11 cli3 sendmail[23841]: g4HBCja23841: collect: premature EOM: Error 0
> | May 17 13:14:11 cli3 sendmail[24045]: g4HBDxa24045: collect: unexpected close on connection from cli119.cli.de, sender=<cc@ivu-ac.de>: Error 0
> `----
>
> and Emacs reports: "writing to process, invalid argument, SMTP
>
> The workaround is to
>
> (defadvice smtpmail-send-data(around smtpmail-send-data-delay act)
>   (sleep-for 1)
>   ad-do-it)
>
> which simply makes a pause of 1 sec in smtpmail.el's code:
>
> ,----
> |   ;; DATA
> |   (smtpmail-send-command process "DATA")
> | 
> |   (if (or (null (car (setq response-code (smtpmail-read-response process))))
> |           (not (integerp (car response-code)))
> |           (>= (car response-code) 400))
> |       (throw 'done nil)
> |     )
> |
> |   ;; !!!! here: wait 1 sec 
> |   ;; Mail contents
> |   (smtpmail-send-data process smtpmail-text-buffer)
> `----
> ----------

  reply	other threads:[~2002-05-19  0:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-18 18:49 [cc@ivu-ac.de: Re: Problem sending bigger mails with CVS Gnus + CVS Emacs] Richard Stallman
2002-05-19  0:07 ` Simon Josefsson [this message]
2002-05-19 19:40   ` Richard Stallman
2002-05-20  9:35     ` Alex Schroeder
2002-05-21 15:58       ` Richard Stallman
2002-05-24  0:45         ` Alex Schroeder
2002-05-24 21:14           ` Richard Stallman
2002-05-20 10:58     ` Simon Josefsson
2002-05-20 21:33       ` Richard Stallman
2002-05-21 10:02   ` Christoph Conrad
2002-05-19 10:23 ` Jason Rumney
2002-05-20 14:47   ` Richard Stallman
2002-05-20 21:47 ` Jason Rumney
2002-05-20 23:36   ` Tak Ota
2002-05-21 20:32     ` Jason Rumney
2002-05-21 22:40       ` Tak Ota
2002-05-22  1:41         ` Tak Ota
2002-05-22 16:03       ` Tak Ota
2002-05-21  9:53   ` Christoph Conrad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ilu661l2e5l.fsf@latte.josefsson.org \
    --to=jas@extundo.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).