Hi,

when I disable the option detach-on-destroy the tmux server sometimes
segfaults. The problem is that in server_next_session (server-fn.c)
s_loop is sometimes NULL and tmux segfaults in line 374.
I'm attaching a patch with some debug output and the corresponding lines
from the log.
I could reproduce this with 3 or more clients and when closing the
sessions fast enough.
Any ideas?

Regards
Simon
Index: server-fn.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server-fn.c,v
retrieving revision 1.110
diff -u -r1.110 server-fn.c
--- server-fn.c	11 Aug 2010 22:16:43 -0000	1.110
+++ server-fn.c	5 Oct 2010 13:25:27 -0000
@@ -365,13 +365,21 @@
 	struct session *s_loop, *s_out;
 	u_int		i;
 
+	log_warnx("Length %d", ARRAY_LENGTH(&sessions));
+
 	s_out = NULL;
 	for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
+		log_warnx("Checking %d", i);
 		s_loop = ARRAY_ITEM(&sessions, i);
 		if (s_loop == s)
 			continue;
+		if (s_loop == NULL) {
+			log_warnx("s_loop is NULL! i : %d", i);
+			continue;
+		}
 		if (s_out == NULL ||
 		    timercmp(&s_loop->activity_time, &s_out->activity_time, <))
+			log_warnx("Switching to %d", i);
 			s_out = s_loop;
 	}
 	return (s_out);
[...]
session 0 destroyed
Length 3
Checking 0
s_loop is NULL! i : 0
Checking 1
Switching to 1
Checking 2
[...]
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to