Re: --enable-thread-safety bug

From: Steve Clark <sclark(at)netwolves(dot)com>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: --enable-thread-safety bug
Date: 2008-03-23 17:29:44
Message-ID: 47E69388.5070503@netwolves.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Meskes wrote:
> On Sat, Mar 22, 2008 at 04:58:28PM -0400, Steve Clark wrote:
>
>>Not exactly sure what you are asking about - descriptors and auto
>>allocating.
>
>
> So I guess you don't use either feature. :-)
>
>
>>The program processes about 800000 packets a day, which can update
>>several tables.
>>It runs continously reading udp packets from systems at remote locations
>>coming in over the internet.
>
>
> But the code for processing all thoss statements is the same, with and
> without threading enabled.
>
> One code that differs is allocation of sqlca, but given that this
> structure has a mere 215 bytes (about). Even if it was allocated 800000
> times it would make up for a memory loss of about 164MB. Which brings up
> the question how long the application runs until it segfaults.
>
> As Tom already pointed out, without more information there simply is no
> way for us to find out what's going on. We are more than willing to dig
> into it, but we need more to be able to.
>
> Michael

Ok I tryed valgrind and after a while it dies with a valgrind
assertion error before providing any
useful data.

So I tried linking with -lc_r and it appears to have stopped the leak.
Without -lc_r
using "top" my app quickly climbed over 150mbyte in memory size - it
is now staying steady
at about 8mb - which is about what it ran when I compiled the ecpg lib
without --enable-thread-safety
enabled.

Now why does this make a difference in ecpg?

HTH,
Steve

If anyone cares below is the valgrind assertion failure:
valgrind: vg_malloc2.c:1008 (vgPlain_arena_malloc): Assertion `new_sb
!= ((void*)0)' failed.
==4166== at 0xB802BE1F: (within /usr/local/lib/valgrind/stage2)
==4166== by 0xB802BE1E: (within /usr/local/lib/valgrind/stage2)
==4166== by 0xB802BE5D: vgPlain_core_assert_fail (in
/usr/local/lib/valgrind/stage2)
==4166== by 0xB8028091: vgPlain_arena_malloc (in
/usr/local/lib/valgrind/stage2)

sched status:

Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
==4166== at 0x3C03894B: calloc (in
/usr/local/lib/valgrind/vgpreload_memcheck.so)

Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to: valgrind.kde.org

In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using. Thanks.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2008-03-23 20:48:28 Insert
Previous Message Michael Meskes 2008-03-23 17:12:25 Re: --enable-thread-safety bug