WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] xs_read problem leads segmentation fault

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] xs_read problem leads segmentation fault
From: Gihan Munasinghe <GMunasinghe@xxxxxxxxxxxxxx>
Date: Thu, 05 Mar 2009 14:49:32 +0000
Delivery-date: Thu, 05 Mar 2009 06:49:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090107)

Hi

I am having a problem with xs_read..
In my program I want to create a VM and get the vnc port out of it.. and this is a multi threaded programs.. but I have made sure that there will be only one create at a time

This is the function that reads the vnc port off the xenstore
------------------------------------------------------------------------------------------------------------------------------
/**
* Returns the VNC port for a given dom ID
* 0 in case of a failure
*/
unsigned int get_vnc_port(unsigned int dom_id){
           unsigned int port = 0;
               unsigned int len=0;
       struct xs_handle* xsn;
       xsn = connect_to_xenstore();
       if(xsn){
               char s[40];
snprintf(s, 39, "/local/domain/%u/console/vnc-port", dom_id);
               s[39] = 0;
               LOG_INFO_MSG("Trying to read %s off XEN Store",s);
               char *vnc_port = (char *)xs_read(xs,0,&s[0],&len);
LOG_INFO_MSG("Value read %p off XEN Store LEN %u",vnc_port,len);
               close_conn_xenstore(xsn);
               if(vnc_port && len>0){
                       LOG_INFO_MSG("VNC port from xs %s ",vnc_port);
                       port = atoi(vnc_port);
                       free(vnc_port);
LOG_INFO_MSG("VNC port for dom %u is %u ",dom_id,port);
               }else{
LOG_ERROR_MSG("Could Not get the VNC port for dom %u",dom_id);
               }

       }else{
               LOG_ERROR_MSG("Could Not Connect to xenstore");
       }
       return port;
}
---------------------------------------------------------------------------------------------

This code works most of the time but at some point it gives segmentation fault
The Logging Info
 LOG_INFO_MSG("Value read %p off XEN Store LEN %u",vnc_port,len);
log out the following before the segmentation fault happens (seems like some sort of a garbage memory ) Mar 5 14:16:50 Agent: [25238]: Value read 0xffffffffac0008f0 off XEN Store LEN 4

When this work The info log looks as follows
Mar  5 14:16:43 Agent: [25238]: Value read 0x63e5a0 off XEN Store LEN 4

Does any one have ant insight to why this is happening.. or a way of avoiding this..

Thanks

--
Gihan Munasinghe
Development Team Leader
XCalibre Communications Ltd.
www.flexiscale.com


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] xs_read problem leads segmentation fault, Gihan Munasinghe <=