Need help with TRAP: FailedAssertion("!(context != CurrentMemoryContext)"

From: Stephen Woodbridge <woodbri(at)swoodbridge(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Need help with TRAP: FailedAssertion("!(context != CurrentMemoryContext)"
Date: 2013-04-20 20:32:36
Message-ID: 5172FB64.6040509@swoodbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I have been writing pg extensions for a while but I just ran into a
problem that has me stumped.

I have code for a SRF and it works fine on pg 9.2.2 on linux, but fails
with am error in the logfile.

TRAP: FailedAssertion("!(context != CurrentMemoryContext)", File:
"mcxt.c", Line: 172)

I have run it in single user mode with valgrind on linux and it is clean
from memory overwrites or leaks. I fails under mingw 32 bit and mingw 64
bit builds. I have other code that works fine so I don't think it is a
build environment issue.

I have also run tests on the library using a test harness (ie: outside
of postgresql) and it runs clean on windows and linux.

The code runs and generates the correct results, and this crash is when
I call SPI_finish().

So I would appreciate any ideas on how I can trace done the issue and
fix it.

Thanks,
-Steve

The code and my mingw build is below, the paths would need to change for
another environment. The source file in questions is
address_standardizer.c if you want to look at it. If you want to run it
let me know and I can provide details.

#!/bin/sh
wget -O pagc-postgresql.tgz
'http://pagc.svn.sourceforge.net/viewvc/pagc/branches/sew-refactor/postgresql/?view=tar'
rm -rf postgresql
tar xzf pagc-postgresql.tgz
cd postgresql

export
PATH='/c/ming32/projects/gettext/rel-gettext-0.18.1/bin:/c/ming32/projects/xsltproc:/c/ming32/projects/gtk/bin:/c/ming32/projects/rel-libiconv-1.13.1w32/include:.:/bin:/include:/mingw/bin:/mingw/include:/c/Windows/system32:/c/Windows:/usr/local/bin:/c/ming32/Silksvn/bin::/c/ming32/projects/pgx32/pg92w32/bin:/c/ming32/projects/pgx32/pg92w32/lib'

make SHLIB_LINK="-L/c/ming32/msys/local/lib -Wl,--enable-stdcall-fixup
-lpostgres -lpgport -lwsock32 -lm -lws2_32 -lshfolder -lpcre"
CPPFLAGS=-I/usr/local/include && make install

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-04-20 21:00:32 Re: Need help with TRAP: FailedAssertion("!(context != CurrentMemoryContext)"
Previous Message Joel Jacobson 2013-04-20 20:27:46 Re: [GSOC] questions about idea "rewrite pg_dump as library"