Re: Intermittent bug

Поиск
Список
Период
Сортировка
От Thomas Hallgren
Тема Re: Intermittent bug
Дата
Msg-id thhal-0WoeBAh0VcC4LWR8wt0KvXOAhvkqVqG@mailblocks.com
обсуждение исходный текст
Ответ на Intermittent bug  (Thomas Hallgren <thhal@mailblocks.com>)
Ответы Re: Intermittent bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
After some pretty tedious assembly debugging I've managed to locate the 
source of my problem. It is probably similar to a bug involving 
MemoryContext life cycle on IMMUTABLE functions that I struggled with 
last winter (later fixed by Tom).

This is what happens:

I have an function declared as IMMUTABLE that returns a SETOF tuples. I 
palloc some data using the context->multi_call_memory_context during the 
SRF_IS_FIRSTCALL phase and I assign that data to the context->user_fctx.

I obtain the context again using SRF_PERCALL_SETUP() and from that my 
palloc'ed data. I have verified that I get the exact same pointer. I do, 
but the memory that it points to is no longer accessible! I get an 
access fault and I can't even display that memory in the debugger. This 
tells me that the memory is no longer bound to the process, it must have 
been free'd up.

What life span does the context->multi_call_memory_context have in case 
of IMMUTABLE functions that returns SETOF?

Regards,
Thomas Hallgren




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Adam Witney
Дата:
Сообщение: Re: problem installing 8.0.0beta5 on OS X 10.3
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Explain output: wrong row count?