On Mon, Jun 6, 2011 at 21:16, Robert Creager <robert.crea...@oracle.com> wrote:

> That's weird. Why it should hang there I have no idea. Did it hang at the
> same spot both times? Can you get a backtrace?
>
> I think so, but I didn't pay much attention :-(
> GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC
> 2011)
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "x86_64-apple-darwin"...Reading symbols for
> shared libraries ...... done
>
> Attaching to program: `/Volumes/High
> Usage/usr/local/src/build-farm-4.4/builds/HEAD/inst/bin/postgres', process
> 24698.
> Reading symbols for shared libraries .+++++......... done
> 0x0000000100a505e4 in Perl_get_hash_seed ()
> (gdb) bt
> #0  0x0000000100a505e4 in Perl_get_hash_seed ()
> #1  0x0000000100a69b94 in perl_parse ()

Perl_get_hash_seed is basically:

Perl_get_hash_seed {
    char *s = getenv("PERL_HASH_SEED");
    unsigned long myseed = 0;
    if(s) {
      ....
      myseed = atoul(s);
    }
    srand(Perl_seed());
    myseed = rand() *  UV_MAX;
    return myseed;
}

U32 Perl_seed()
{
    U32 u;
    struct timeval when;
    ...
    open(fd, "/dev/urandom"...)
    read(fd, &u, sizeof(u));
    gettimeofday(&when, NULL);
    u = when[0] + SEED_C2 * when[1];
    u += getpid();
    u += PTR2UV(PL_stack_sp);
    return u;
}

I don't suppose /dev/urandom blocks on OS X?  Granted, I may have
missed something in translation with the macro fest that is perl...

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to