Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Location
    DE
    Posts
    2

    Unanswered: Pro*C Core dump in Oracle 10.2.0.3 on Solaris 10

    Hello Folks, I'm a newbie here, so please bear with me. Thanks in advance. I've searched the web for a few days, and tried many things, with no solution. We are in the process of moving our Pro*C applications to new servers (from Oracle 9.2.0.8 Solaris 8, 32-bit) to Oracle 10.2 Solaris 10, 64-bit. I am getting a pesky core dump that we have not gotten before. Wonder if anyone has seen the behavior described below?

    I distilled the appl code down to the minimum to replicate the problem (below). The main() (mincaller.pc) is dumping core when accessing a string pointer which is created in a common lib file (mintable.c). The core does not happen if I embed the mintable.c code directly in the main file. The core also does not happen if I do not link with any Pro*C libs, but rather just compile as straight C code. On running dbx with memory checking I get the following unallocated writes, then the core.

    Thanks,
    -Greg

    RTC: Enabling Error Checking...
    RTC: Using UltraSparc trap mechanism
    RTC: See `help rtc showmap' and `help rtc limitations' for details.
    RTC: Running program...
    Write to unallocated (wua) on thread 1:
    Attempting to write 8 bytes at address 0xffffffff7f5001d0
    t@1 (l@1) stopped in _private_pthread_atfork at 0xffffffff5bd4b2dc
    0xffffffff5bd4b2dc: _private_pthread_atfork+0x003c: ba,a 0xffffffff5bb63f14 ! 0xffffffff5bb63f14
    (dbx) where
    current thread: t@1
    =>[1] _private_pthread_atfork(0xffffffff67555d7c, 0xffffffff67555ddc, 0xffffffff67555dac, 0xffffffff7f5001c0, 0xffffffff676b6978, 0xffffffff5bef7f60), at 0xffffffff5bd4b2dc
    [2] _init(0xffffffff7f7361b8, 0xffffffff7f738bb0, 0x11a8d0, 0x0, 0xffffffff7f736c60, 0x861), at 0xffffffff6759d7e0
    [3] call_init(0xffffffff7f736530, 0x1, 0xffffffff6759d7d8, 0xffdfffff, 0xffffffff7f736c60, 0xffffffffffffffff), at 0xffffffff7f6180e4
    [4] setup(0x0, 0x2500602, 0x2500602, 0x47, 0xc10001, 0xffffffff7f736540), at 0xffffffff7f6175c0
    [5] _setup(0xb00, 0xffffffff7ffff838, 0xffffffff7f605a20, 0x100000040, 0x0, 0xffffffffffffffff), at 0xffffffff7f626e44
    [6] _rt_boot(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xffffffff7f60a9b8
    (dbx) cont
    Write to unallocated (wua) on thread 1:
    Attempting to write 8 bytes at address 0xffffffff7f5001d8
    t@1 (l@1) stopped in _private_pthread_atfork at 0xffffffff5bd4b2f0
    0xffffffff5bd4b2f0: _private_pthread_atfork+0x0050: ba,a 0xffffffff5bb63f54 ! 0xffffffff5bb63f54
    (dbx) where
    current thread: t@1
    =>[1] _private_pthread_atfork(0xffffffff67555d7c, 0xffffffff67555ddc, 0xffffffff67555dac, 0xffffffff7f5001c0, 0xffffffff676b6978, 0xffffffff5bef7f60), at 0xffffffff5bd4b2f0
    [2] _init(0xffffffff7f7361b8, 0xffffffff7f738bb0, 0x11a8d0, 0x0, 0xffffffff7f736c60, 0x861), at 0xffffffff6759d7e0
    [3] call_init(0xffffffff7f736530, 0x1, 0xffffffff6759d7d8, 0xffdfffff, 0xffffffff7f736c60, 0xffffffffffffffff), at 0xffffffff7f6180e4
    [4] setup(0x0, 0x2500602, 0x2500602, 0x47, 0xc10001, 0xffffffff7f736540), at 0xffffffff7f6175c0
    [5] _setup(0xb00, 0xffffffff7ffff838, 0xffffffff7f605a20, 0x100000040, 0x0, 0xffffffffffffffff), at 0xffffffff7f626e44
    [6] _rt_boot(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xffffffff7f60a9b8
    (dbx) cont
    getstr: get returning value str[hellothere] [0x68]dec[104] at [0x101438]
    main: getstr returned value at ret_ptr[0x101438]...
    t@1 (l@1) signal SEGV (no mapping at the fault address) in __rtc_strlen at 0xffffffff7192d978
    0xffffffff7192d978: __rtc_strlen+0x0080: ld [%o1], %o2
    Current function is main
    15 fprintf(stdout, "main: getstr returned value [%s] at ret_ptr[0x%x]", ret_ptr, ret_ptr);
    (dbx)

    ----- mincaller.pc ---------

    #include <stdio.h>
    EXEC SQL INCLUDE sqlca;

    char *get_str();

    main (int argc, char *argv[]) {

    char *ret_ptr;

    ret_ptr = (char *) getstr();

    fprintf(stdout, "main: getstr returned value at ret_ptr[0x%x]...\n", ret_ptr);
    fflush(stdout);

    fprintf(stdout, "main: getstr returned value [%s] at ret_ptr[0x%x]", ret_ptr, ret_ptr);
    fflush(stdout);

    exit(0);

    } /* main */

    ---- mintable.c ------

    #include <string.h>
    #include <stdio.h>

    static char *descstr = "hellothere";

    char* getstr();

    /* get descstrription field */
    char* getstr(){
    fprintf(stdout, "getstr: get returning value str[%s] [0x%x]dec[%d] at [0x%x]\n",
    descstr, *(descstr), *(descstr), descstr);
    fflush(stdout);
    return descstr;
    }

    --------- end ---------

  2. #2
    Join Date
    Oct 2008
    Location
    DE
    Posts
    2
    OK, I'm humbled, this was a gotcha. The declaration in mincaller is
    char *get_str();
    but should be this:
    char *getstr();
    Didnt get any warnings until I tweaked my Makefile. With effectively no declaration of getstr(), the compiler apparently was assuming that the fct returned an int, rather than a char *. Declaring getstr() properly fixed the core dump. But on running dbx, I still get the write to unallocated mem errors. Dont know if this is something to be concerned about?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •