Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

An interesting thread problem

  • 01-09-2003 12:29AM
    #1
    Closed Accounts Posts: 5,563 ✭✭✭


    I have two boxes.

    One running Red hat 7.0 Linux 2.4.18-14

    One running Red at 8.0 Linux 2.2.16-22smp

    Struct similar to this

    struct typie{
    int a;
    int b;
    char value[200];
    }typie_t;

    In function x on Red hat 7.0
    I go

    typie_t v;
    v.a=100;

    pthread_create(instance,0,function,&v);

    in function()
    all is well and this executes a happy as pie.

    In Red Hat 8.0

    I do the same thing and I get
    interesting and yet worrying results
    [webop@searcher tjulia]$ strace -p 28894
    accept(1, {sin_family=AF_UNSPEC, {sa_family=0, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, [16]) = 2
    getrlimit(0x3, 0xbfff9ce0) = 0
    pipe([3, 4]) = 0
    clone(child_stack=0x80fd958, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 28940
    write(4, "\373\211\0@\5\0\0\0\0\0\0\0\0000\3@H\240\377\277\204\207"..., 148) = 148
    rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
    write(4, "\240\340\6@\0\0\0\0\0\0\0\0p\272\4\10\254\241\377\277\0"..., 148) = 148
    rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
    rt_sigsuspend([] <unfinished ...>
    --- SIGRTMIN (Unknown signal 32) ---
    <... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call)
    sigreturn() = ? (mask now [RTMIN])
    --- SIGSEGV (Segmentation fault) ---

    That's the strace from the failed call on RH8.

    Here is the lexically sucessful equivalent on RH 7.
    [bodonoghue@converatest tjulia]$ strace -p 29328
    accept(1, {sin_family=AF_UNSPEC, {sa_family=0, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, [16]) = 2
    getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=2147483647}) = 0
    setrlimit(RLIMIT_STACK, {rlim_cur=2044*1024, rlim_max=2147483647}) = 0
    pipe([3, 4]) = 0
    clone(child_stack=0x80fdf00, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 29332
    write(4, "\0\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0"..., 148) = 148
    rt_sigprocmask(SIG_SETMASK, NULL, [RT_0], 8) = 0
    write(4, "@:\7@\0\0\0\0\0\0\0\0p\266\4\10\340k\377\277\0\0\0\200"..., 148) = 148
    rt_sigprocmask(SIG_SETMASK, NULL, [RT_0], 8) = 0
    rt_sigsuspend([] <unfinished ...>
    --- SIGRT_0 (Real-time signal 0) ---

    Can somebody shed a little light on this error or me? It's looks to me that "interrupted system call" is the culprit, but... I still don't quite fathom how to cicrumvent this error.
    Any help appreciated.

    Muchos Gracias.


Comments

  • Closed Accounts Posts: 5,563 ✭✭✭Typedef


    void networking::networking_do_loop(){
    /*Main loop to accept connections and call the search functions*/
    int state,b,num_bytes,fd;
    sigset_t sigs;
    socklen_t slen;
    char incoming[22];
    MAX_FD=0;
    trans_t tr;

    tr.iMaxDocs=iMaxDocs;
    tr.iWeight=iWeight;
    strncpy(tr.cRWServer,cRWServer,1024);
    strncpy(tr.pgstr,pgstr,1024);
    #if defined(DEBUG)
    syslog(LOG_NOTICE,"Object vales %s %s %d %d\n",
    tr.cRWServer,tr.pgstr,tr.iMaxDocs,tr.iWeight);
    #endif
    while(1){
    fd=accept(srv_skfd,(struct sockaddr*)&cli,&slen);
    #if defined(DEBUG)
    syslog(LOG_NOTICE,"Accepted client connection on %d \n",fd,MAX_FD);
    #endif
    tr.skfd=fd;
    /*Create a separate thread for each separate connection instance!*/
    sigemptyset(&sigs);
    sigaddset(&sigs,SIGRTMIN);
    pthread_sigmask(SIG_BLOCK,&sigs,0);
    pthread_create(&thread_dref,0,socket_thread,&tr);
    }
    return;
    };


    I'm glad we had this chance to talk...

    "oh there'll be a hot time... in the old town ... tonight...."""

    Very interesting.


  • Registered Users, Registered Users 2 Posts: 16,415 ✭✭✭✭Trojan


    Ah, so it's pthreads (same codebase, right?).

    What happens in single processor mode on 2.2.16-22smp? Can you switch that on?

    Al.


  • Closed Accounts Posts: 5,563 ✭✭✭Typedef


    I think the problem was that Linux -2.4.x was sending a signal I wasn't handling, while 2.2, wasn't sending any signals, so the proggie didn't crash.


Advertisement