From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | amit(dot)kapila16(at)gmail(dot)com |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Retain dynamic shared memory segments for postmaster lifetime |
Date: | 2014-01-31 08:05:19 |
Message-ID: | 20140131.170519.112013497.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello, I've managed to reconstruct windows build environment and
tried to run the previous patch.
====================
> > - DSM implimentation seems divided into generic part (dsm.c) and
> > platform dependent part(dsm_impl.c). This dsm_keep_segment
> > puts WIN32 specific part directly into dms.c. I suppose it'd
> > be better defining DSM_OP_KEEP_SEGMENT and calling dms_impl_op
> > from dms_keep_segment, or something.
> >
> > - Repeated calling of dsm_keep_segment even from different
> > backends creates new (orphan) handles as many as it is called.
> > Simplly invoking this function in some of extensions intending
> > to stick segments might results in so many orphan
> > handles. Something to curb that situation would be needed.
>
> I think the right way to fix above 2 comments is as suggested by Robert.
Fine. I have no objection on that way.
> > - "Global/PostgreSQL.%u" is the same literal constant with that
> > occurred in dsm_impl_windows. It should be defined as a
> > constant (or a macro).
> >
> > - dms_impl_windows uses errcode_for_dynamic_shared_memory() for
> > ereport and it finally falls down to
> > errcode_for_file_access(). I think it is preferable, maybe.
>
> Okay, will take care of these in new version after your verification
> on Windows.
I will apologize in advance for probably silly questions but I
have two problems.
====
Server was crashed by dsm_demo_read on my test environment but
unfortunately the cause is still uncertain for me.
| LOG: server process (PID 19440) was terminated by exception 0xC0000005
| DETAIL: Failed process was running: select dsm_demo_read(4294967297);
| HINT: See C include file "ntstatus.h" for a description of the hexadecimal value.
| LOG: terminating any other active server processes
0xC0000005 is ACCESS_VIOLATION. The crash occurred at aset.c:853
| /* Try to allocate it */
| block = (AllocBlock) malloc(blksize);
Where blksize is 55011304... It's sasier to investigate still
more if I could step into functions in the dynamic loaded module,
but VC2008 IDE skips over the function body:-( Do you have any
idea how I can step into there? My environment is VC2008 Express/
Win7-64. Step-into bounces back at the line where function
definition.
| PG_FUNCTION_INFO_V1(dsm_demo_create);
In contrast, dsm_demo_create doesn't crash and seems to return
sane vaule.
| =# select dsm_demo_create('hoge', 100);
| dsm_demo_create
| -----------------
| 4294967297
===
And the another problem is perhaps not the issue of this module
but it happened for me.
| =# create extension dsm_demo;
| ERROR: could not find function "dsm_demo_create" in file "c:/pgsql/lib/dsm_demo.dll"
I've found that generated dll file exports the function with the
names following after some investigation.
| ...\Debug>dumpbin /EXPORTS dsm_demo.dll
| Microsoft (R) COFF/PE Dumper Version 9.00.21022.08
| Copyright (C) Microsoft Corporation. All rights reserved.
(snipped)
| 1 0 0001100A Pg_magic_func = @ILT+5(_Pg_magic_func)
| 2 1 00011118 pg_finfo_dsm_demo_create = @ILT+275(_pg_finfo_dsm_demo
| _create)
| 3 2 000110AF pg_finfo_dsm_demo_read = @ILT+170(_pg_finfo_dsm_demo_r
Then explicitly designating the function name in 'CREATE
FUNCTION' in dsm_demo--1.0.sql stops the complaint. I might did
something wrong in setting up build environment for this dll but
I have no idea which would cause this kind of trouble..
| CREATE FUNCTION dsm_demo_create(pg_catalog.text, pg_catalog.int4 default 0)
| RETURNS pg_catalog.int8 STRICT
| AS 'MODULE_PATHNAME', 'pg_finfo_dsm_demo_create'
| LANGUAGE C;
Do you have any idea for this?
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2014-01-31 08:05:46 | Re: Performance Improvement by reducing WAL for Update Operation |
Previous Message | Michael Paquier | 2014-01-31 07:28:49 | Re: Regression tests failing if not launched on db "regression" |