Unexpected Null Pointer For Static Shared Memory Segment

Поиск
Список
Период
Сортировка
От Aditya Gupta
Тема Unexpected Null Pointer For Static Shared Memory Segment
Дата
Msg-id CH3PR10MB7834DBC41FA44C8844B7C5F9F1B52@CH3PR10MB7834.namprd10.prod.outlook.com
обсуждение исходный текст
Список pgsql-hackers

Hello,

 

I hope this message finds you well. I am currently working on a PostgreSQL extension and have encountered an issue where a static pointer becomes null between different AM routines. My problem is as follows:

 

I am working with a few AM routines, specifically “ambuild” and “amrescan”. During “ambuild”, I use “ShmemInitStruct” to initialize a segment of shared memory and save the pointer to this location in my static, global pointer. I then set some values of the structure that the pointer points to, which I believe works correctly. I have ensured to acquire, and later release, the “AddinShmemInitLock” as well as check if we have found a segment of the same name in shared memory. I can access the pointer and any data I save in the struct perfectly fine during this AM routine. 

 

When the extension later performs “amrescan”, the static pointer I had set is null. I am not quite sure why this is happening. I would greatly appreciate any guidance or suggestions! Perhaps I need to use the startup hooks when calling the “ShmemInitStruct” function (although I would like to avoid this as the size of the segment I am initializing varies at run time) or use dynamic shared memory?

 

Please let me know if there are any more details I can provide or if anything is unclear. Thanks for your time and assistance!

 

Best,

Aditya Gupta

 

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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Protocol question regarding Portal vs Cursor
Следующее
От: Andreas Karlsson
Дата:
Сообщение: Re: tiny step toward threading: reduce dependence on setlocale()