Menu

Auto-start problems

2011-08-22
2014-09-18
  • Chris Thompson

    Chris Thompson - 2011-08-22

    Hi,

    I have spent some time testing PCD and I like what it has to offer.  I am developing for an embedded system running Ubuntu 8.04 LTS on an Intel architecture.  At the moment I am most interested in the segmentation fault handling so that I can track down some intermittent problems.

    I am able to start PCD from the command line, and then execute a process with a segmentation fault.  From there I am able to use the PCD output to track down the file and line number where the error occurs.

    However, for the life of me, I cannot get PCD to work how I want when I auto-start it.  I have created a startup script that is supposed to output to a folder with R/W/X permissions for everyone (777, at least until I get something working):

    1
    2
    #! /bin/sh
    /usr/sbin/pcd -e /segFaultLogs/segFault.log -c
    

    I have registered it for startup:

    sudo update-rc.d pcdStart defaults 97 03
    

    And I have verified that PCD is running after boot.  I have also called "PCD_API_REGISTER_EXCEPTION_HANDLERS()" to make my process use the exception handlers provided by PCD (and again, I verified that this works when I start PCD from the command line).

    However, when I run the same seg-faulting app after startup, I do not see my error file get populated.  Then I start seeing the following error in my output file: "Error: Failed to start IPC."  I have also seen "Error removing old socket", indicating a socket access issue.

    Am I making an obvious mistake?  Do you have an example of a proper startup script? 

     
  • Hai Shalom

    Hai Shalom - 2011-08-29

    Hi,

    The PCD was designed and developed to run on embedded platforms with uClibc/Busybox. I'm glad that it works for you in the command line, but I'm not sure why it doesn't work on your environment when you try to use start up scripts (nor I have any way to debug it).
    If you'll find a solution or workaround I'll appreciate if you'd share it with us.

     
  • Abel Zhang

    Abel Zhang - 2014-09-18

    This issue is caused by IPC_UNIX_PATH "/var/tmp/pcd-server.ctl":
    if IPC_SOCKET_PATH folder/path "/var/tmp" does NOT exist, IPC socket bind will fail.

    We could create IPC_SOCKET_PATH folder/path manually:

    @@ -122,7 +122,7 @@
    * \brief The path for the IPC sockets (platform depended - can be overridden by the makefile)
    /
    #ifndef IPC_SOCKET_PATH
    -#define IPC_SOCKET_PATH "/var/tmp"
    +#define IPC_SOCKET_PATH "/var/pcd"
    #endif /
    IPC_SOCKET_PATH */

    /*! \def IPC_UNIX_PATH_MAX
    @@ -305,6 +305,7 @@
    struct sockaddr_un sun;
    int32_t fd;
    int32_t i = 0;
    + char cmd_sun_path[IPC_UNIX_PATH_MAX];

     ENTER_FUNC;
    

    @@ -348,15 +349,20 @@
    pthread_mutex_unlock( &IPC_Clients->lock );
    return IPC_STATUS_NOK;
    }
    +
    + bzero(&sun, sizeof(struct sockaddr_un));
    sun.sun_family = AF_UNIX;
    snprintf( sun.sun_path, IPC_UNIX_PATH_MAX, "%s/%s.ctl", IPC_SOCKET_PATH, myName );
    + snprintf( cmd_sun_path, IPC_UNIX_PATH_MAX, "mkdir -p %s", IPC_SOCKET_PATH);
    + system(cmd_sun_path);

     

Log in to post a comment.