[evolution-patches] 59717, evolution mail crash




Hi guys,

Another mailer crasher fix.

This is in two parts, one is low-risk but has unpleasant user side-effects, the other part is higher risk and may need more testing first but fixes the side-effects.

Making the dialogue modal fixes the nasty re-entrancy we can get in this non-reentrant synchronous method - i tried various ways around doing this but it got too complex, and as far as i can tell could never work.  However when you connect to a host using SSL, cancellation is a noop, so it can take 4 minutes to time out.  4 minutes in which time you can't do anything else.  e.g. if the user put in the wrong hostname they're kind of stuck.

Which is where the second patch comes in, it enables cancellation for a SSL connect.  Its only high risk in that this code has forever caused lots of issues, so i'm not sure if the fix breaks it in subtle ways.  I did some testing and it appears to work though - "i don't see why it shouldn't work".  I guess it can wait till 2.0.1 if need be.

Michael

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3444.2.2
diff -u -3 -r1.3444.2.2 ChangeLog
--- mail/ChangeLog	1 Sep 2004 14:27:22 -0000	1.3444.2.2
+++ mail/ChangeLog	3 Sep 2004 04:18:09 -0000
@@ -1,3 +1,11 @@
+2004-09-03  Not Zed  <NotZed Ximian com>
+
+	** See bug #59717.
+
+	* mail-config.c (mail_config_check_service): Make the dialog
+	modal.  Not ideal but a problem with the way the function works,
+	it should be fully async instead.
+
 2004-08-30  Jeffrey Stedfast  <fejj novell com>
 
 	* em-folder-tree.c (emft_popup_delete_folder): Set the store and
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.310
diff -u -3 -r1.310 mail-config.c
--- mail/mail-config.c	12 Aug 2004 06:53:45 -0000	1.310
+++ mail/mail-config.c	3 Sep 2004 04:18:09 -0000
@@ -970,8 +970,12 @@
 	id = m->msg.seq;
 	e_thread_put(mail_thread_new, (EMsg *)m);
 
+	/* FIXME: make this use e-error.
+	 * It has to be modal otherwise we can get nasty re-entrancy whilst waiting for the
+	 * subthread to complete.
+	 * FIXME: make this whole function async to deal with this issue */
 	dialog = gtk_dialog_new_with_buttons(_("Connecting to server..."), window,
-					     GTK_DIALOG_DESTROY_WITH_PARENT,
+					     GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL,
 					     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 					     NULL);
 	label = gtk_label_new (_("Connecting to server..."));
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251
diff -u -3 -r1.2251 ChangeLog
--- camel/ChangeLog	26 Aug 2004 09:28:45 -0000	1.2251
+++ camel/ChangeLog	3 Sep 2004 04:00:48 -0000
@@ -1,3 +1,8 @@
+2004-09-03  Not Zed  <NotZed Ximian com>
+
+	* camel-tcp-stream-ssl.c (stream_connect): make ssl connection
+	async and cancellable, and minor api update to async connection.
+
 2004-08-26  Sivaiah Nallagatla <snallagatla novell com>
 	
 	* provoders/groupwise/camel-gw-listner.c 
Index: camel/camel-tcp-stream-ssl.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-tcp-stream-ssl.c,v
retrieving revision 1.62
diff -u -3 -r1.62 camel-tcp-stream-ssl.c
--- camel/camel-tcp-stream-ssl.c	4 Jun 2004 18:04:07 -0000	1.62
+++ camel/camel-tcp-stream-ssl.c	3 Sep 2004 04:00:48 -0000
@@ -1028,7 +1028,7 @@
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
 	PRNetAddr netaddr;
-	PRFileDesc *fd;
+	PRFileDesc *fd, *cancel_fd;
 	
 	g_return_val_if_fail (host != NULL, -1);
 	
@@ -1070,26 +1070,37 @@
 		
 		fd = ssl_fd;
 	}
-	
-	if (PR_Connect (fd, &netaddr, CONNECT_TIMEOUT) == PR_FAILURE) {
+
+	cancel_fd = camel_operation_cancel_prfd(NULL);
+
+	if (PR_Connect (fd, &netaddr, cancel_fd?0:CONNECT_TIMEOUT) == PR_FAILURE) {
 		int errnosave;
 		
 		set_errno (PR_GetError ());
-		if (errno == EINPROGRESS) {
+		if (errno == EINPROGRESS || (cancel_fd && errno == ETIMEDOUT)) {
 			gboolean connected = FALSE;
-			PRPollDesc poll;
+			PRPollDesc poll[2];
+
+			poll[0].fd = fd;
+			poll[0].in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
+			poll[1].fd = cancel_fd;
+			poll[1].in_flags = PR_POLL_READ;
 			
 			do {
-				poll.fd = fd;
-				poll.in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
-				poll.out_flags = 0;
-				
-				if (PR_Poll (&poll, 1, CONNECT_TIMEOUT) == PR_FAILURE) {
+				poll[0].out_flags = 0;
+				poll[1].out_flags = 0;
+
+				if (PR_Poll (poll, cancel_fd?2:1, CONNECT_TIMEOUT) == PR_FAILURE) {
 					set_errno (PR_GetError ());
 					goto exception;
 				}
 				
-				if (PR_GetConnectStatus (&poll) == PR_FAILURE) {
+				if (poll[1].out_flags == PR_POLL_READ) {
+					errno = EINTR;
+					goto exception;
+				}
+
+				if (PR_ConnectContinue(fd, poll[0].out_flags) == PR_FAILURE) {
 					set_errno (PR_GetError ());
 					if (errno != EINPROGRESS)
 						goto exception;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]