Re: [gtk-vnc-devel] Crash



Em Sáb, 2008-03-15 às 16:24 +0000, Daniel P. Berrange escreveu:
> On Sat, Mar 15, 2008 at 12:55:56PM -0300, Jonh Wendell wrote:
> > Hi, folks.
> > 
> > There is a bug report against Vinagre about a weird crash.
> > Could you take a look at it?
> > http://bugzilla.gnome.org/show_bug.cgi?id=522090
> > 
> > Any hint is welcome :)
> 
> The last debug message printed before it shuts down the widget is
> from this code:
> 
>         GVNC_DEBUG("Resolving host %s %s\n", host, port);
>         memset (&hints, '\0', sizeof (hints));
>         hints.ai_flags = AI_ADDRCONFIG;
>         hints.ai_socktype = SOCK_STREAM;
>         hints.ai_protocol = IPPROTO_TCP;
> 
>         if ((ret = getaddrinfo(host, port, &hints, &ai)) != 0)
>                 return FALSE;
> 
> So I'd say that the host "macros.local" is not resolving, and then during
> the cleanup code to shut down the widget memory is getting corrupted.
> 
> We should put a GVNC_DEBUG() statement in the error path for getaddrinfo()
> really, so we can see the exact error condition there.
> 
> Dan.

Hi, Dan.

I have committed the little attached patch.

In vinagre, when a connection is closed, I get:
wendell wendell-laptop:~/checkout/gtk-vnc$ vinagre adlfjdsl
Expose 0x0 @ 1,1
Started background coroutine
Resolving host adlfjdsl 5900
Failed to resolve hostname
Doing final VNC cleanup
Requesting that VNC close
Requesting that VNC close
Releasing VNC widget

Note the 2 "Requesting that VNC close". Is this right? It's calling
destroy() twice, I guess because the object_ref() we do, but I'm not
sure...

Notice that in the bug report, we have only the first message, and then
the crash:
Requesting that VNC close
Cannot access memory at address 0xb1226004
Cannot access memory at address 0xb1226004

Any hint here, before I ask the bug reporter to try the development version?

Thanks,
-- 
Jonh Wendell
www.bani.com.br

# HG changeset patch
# User Jonh Wendell <wendell bani com br>
# Date 1205614532 10800
# Node ID a0c03e9f8ec114c5e4e289327f200f8ab8e47037
# Parent  a9ba1443ca64c0167d546f7bfb2da4d59d50d615
Put more debug output

diff -r a9ba1443ca64 -r a0c03e9f8ec1 src/gvnc.c
--- a/src/gvnc.c	Fri Mar 14 11:56:33 2008 -0300
+++ b/src/gvnc.c	Sat Mar 15 17:55:32 2008 -0300
@@ -2778,18 +2778,26 @@ gboolean gvnc_open_fd(struct gvnc *gvnc,
 gboolean gvnc_open_fd(struct gvnc *gvnc, int fd)
 {
 	int flags;
-	if (gvnc_is_open(gvnc))
+	if (gvnc_is_open(gvnc)) {
+		GVNC_DEBUG ("Error: already connected?\n");
 		return FALSE;
+	}
 
 	GVNC_DEBUG("Connecting to FD %d\n", fd);
-	if ((flags = fcntl(fd, F_GETFL)) < 0)
+	if ((flags = fcntl(fd, F_GETFL)) < 0) {
+		GVNC_DEBUG ("Failed to fcntl()\n");
 		return FALSE;
+	}
 	flags |= O_NONBLOCK;
-	if (fcntl(fd, F_SETFL, flags) < 0)
+	if (fcntl(fd, F_SETFL, flags) < 0) {
+		GVNC_DEBUG ("Failed to fcntl()\n");
 		return FALSE;
+	}
 
-	if (!(gvnc->channel = g_io_channel_unix_new(fd)))
+	if (!(gvnc->channel = g_io_channel_unix_new(fd))) {
+		GVNC_DEBUG ("Failed to g_io_channel_unix_new()\n");
 		return FALSE;
+	}
 	gvnc->fd = fd;
 
 	return !gvnc_has_error(gvnc);
@@ -2811,31 +2819,38 @@ gboolean gvnc_open_host(struct gvnc *gvn
         hints.ai_socktype = SOCK_STREAM;
         hints.ai_protocol = IPPROTO_TCP;
 
-        if ((ret = getaddrinfo(host, port, &hints, &ai)) != 0)
+        if ((ret = getaddrinfo(host, port, &hints, &ai)) != 0) {
+		GVNC_DEBUG ("Failed to resolve hostname\n");
 		return FALSE;
+	}
 
         runp = ai;
         while (runp != NULL) {
                 int flags, fd;
                 GIOChannel *chan;
 
-                if ((fd = socket(runp->ai_family, runp->ai_socktype,
-                                 runp->ai_protocol)) < 0)
-                        break;
+		if ((fd = socket(runp->ai_family, runp->ai_socktype,
+			runp->ai_protocol)) < 0) {
+			GVNC_DEBUG ("Failed to socket()\n");
+			break;
+		}
 
                 GVNC_DEBUG("Trying socket %d\n", fd);
                 if ((flags = fcntl(fd, F_GETFL)) < 0) {
                         close(fd);
+                        GVNC_DEBUG ("Failed to fcntl()\n");
                         break;
                 }
                 flags |= O_NONBLOCK;
                 if (fcntl(fd, F_SETFL, flags) < 0) {
                         close(fd);
+                        GVNC_DEBUG ("Failed to fcntl()\n");
                         break;
                 }
 
                 if (!(chan = g_io_channel_unix_new(fd))) {
                         close(fd);
+                        GVNC_DEBUG ("Failed to g_io_channel_unix_new()\n");
                         break;
                 }
 
@@ -2856,6 +2871,7 @@ gboolean gvnc_open_host(struct gvnc *gvn
                            errno != EHOSTUNREACH) {
                         g_io_channel_unref(chan);
                         close(fd);
+                        GVNC_DEBUG ("Failed with errno = %d\n", errno);
                         break;
                 }
                 close(fd);
diff -r a9ba1443ca64 -r a0c03e9f8ec1 src/vncdisplay.c
--- a/src/vncdisplay.c	Fri Mar 14 11:56:33 2008 -0300
+++ b/src/vncdisplay.c	Sat Mar 15 17:55:32 2008 -0300
@@ -1600,7 +1600,7 @@ static void vnc_display_finalize (GObjec
 
 	GVNC_DEBUG("Releasing VNC widget\n");
 	if (gvnc_is_open(priv->gvnc)) {
-		g_warning("VNC widget finalized before the connection finished shutting down");
+		g_warning("VNC widget finalized before the connection finished shutting down\n");
 	}
 	gvnc_free(priv->gvnc);
 	display->priv->gvnc = NULL;


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