| From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> | 
|---|---|
| To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: crash with assertions and WAL_DEBUG | 
| Date: | 2014-06-23 09:58:19 | 
| Message-ID: | 53A7FA3B.2080104@vmware.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 06/21/2014 01:58 PM, Heikki Linnakangas wrote:
> It's a bit difficult to attach the mark to the palloc calls, as neither
> the WAL_DEBUG or LWLOCK_STATS code is calling palloc directly, but
> marking specific MemoryContexts as sanctioned ought to work. I'll take a
> stab at that.
I came up with the attached patch. It adds a function called 
MemoryContextAllowInCriticalSection(), which can be used to exempt 
specific memory contexts from the assertion. The following contexts are 
exempted:
* ErrorContext
* MdCxt, which is used in checkpointer to absorb fsync requests. (the 
checkpointer process as a whole is no longer exempt)
* The temporary StringInfos used in WAL_DEBUG (a new memory "WAL Debug" 
context is now created for them)
* LWLock stats hash table (a new "LWLock stats" context is created for it)
Barring objections, I'll commit this to master, and remove the assertion 
from REL9_4_STABLE.
- Heikki
| Attachment | Content-Type | Size | 
|---|---|---|
| alloc-in-crit-1.patch | text/x-diff | 8.0 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2014-06-23 10:07:34 | Re: crash with assertions and WAL_DEBUG | 
| Previous Message | Fujii Masao | 2014-06-23 09:57:39 | Re: Add the number of pinning backends to pg_buffercache's output |