Обсуждение: Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

Поиск
Список
Период
Сортировка

Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
Tom Lane
Дата:
petere@postgresql.org (Peter Eisentraut) writes:
> Log Message:
> -----------
> SQL/MED catalog manipulation facilities

The buildfarm says this patch has got serious portability issues.

grebe, dugong, and ermine are all crashing here:

--- 109,115 ---- (3 rows)  ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');
! server closed the connection unexpectedly
!     This probably means the server terminated abnormally
!     before or while processing the request.
! connection to server was lost

(Unfortunately I can't reproduce this on any of my own machines.)

The Windows MSVC machines are all pretty unhappy too, presumably because
you didn't even try to teach the MSVC build system about the newly added
shared libraries.
        regards, tom lane


Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
"Sergey E. Koposov"
Дата:
Hi,

On Fri, 19 Dec 2008, Tom Lane wrote:

>> SQL/MED catalog manipulation facilities
>
> The buildfarm says this patch has got serious portability issues.
>
> grebe, dugong, and ermine are all crashing here:
>
> --- 109,115 ----
>  (3 rows)
>
>  ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');
> ! server closed the connection unexpectedly
> !     This probably means the server terminated abnormally
> !     before or while processing the request.
> ! connection to server was lost
>
> (Unfortunately I can't reproduce this on any of my own machines.)

Here is the gdb  backtrace from dugong:
-------------------
Core was generated by ostgres: math regression [local] ALTER FOREIGN DATA WRAPPER                  '.
Program terminated with signal 11, Segmentation fault.
#0  0x40000000000560b0 in heap_compute_data_size (    tupleDesc=0x200000000287fbb8, values=0x60000000001ae060,
isnull=0x60000000001ae0b8"") at heaptuple.c:103
 
103                     if (ATT_IS_PACKABLE(att[i]) &&
(gdb) bt
#0  0x40000000000560b0 in heap_compute_data_size (    tupleDesc=0x200000000287fbb8, values=0x60000000001ae060,
isnull=0x60000000001ae0b8"") at heaptuple.c:103
 
#1  0x400000000005cac0 in heap_form_tuple (tupleDescriptor=0x200000000287fbb8,    values=0x60000000001ae060,
isnull=0x60000000001ae0b8"") at heaptuple.c:728
 
#2  0x400000000005d700 in heap_modify_tuple (tuple=0x600000000019e9f8,    tupleDesc=0x200000000287fbb8,
replValues=0x60000fffffb2e318,   replIsnull=0x60000fffffb2e340 "", doReplace=0x60000fffffb2e345 "")    at
heaptuple.c:853
#3  0x4000000000399480 in AlterForeignDataWrapper (stmt=0x6000000000160e78)    at foreigncmds.c:480
#4  0x40000000007b6bc0 in ProcessUtility (parsetree=0x6000000000160e78,    queryString=0x60000000001603b8 "ALTER
FOREIGNDATA WRAPPER foo OPTIONS (a '1', b '2');", params=0x0, isTopLevel=1 '\001', dest=0x6000000000160f10,
completionTag=0x60000fffffb2e96e"") at utility.c:469
 
#5  0x40000000007b2e20 in PortalRunUtility (portal=0x60000000001a5fc8,    utilityStmt=0x6000000000160e78, isTopLevel=1
'\001',   dest=0x6000000000160f10, completionTag=0x60000fffffb2e96e "")    at pquery.c:1183
 
#6  0x40000000007b3380 in PortalRunMulti (portal=0x60000000001a5fc8,    isTopLevel=1 '\001', dest=0x6000000000160f10,
altdest=0x6000000000160f10,   completionTag=0x60000fffffb2e96e "") at pquery.c:1286
 
#7  0x40000000007b1150 in PortalRun (portal=0x60000000001a5fc8,    count=9223372036854775807, isTopLevel=1 '\001',
dest=0x6000000000160f10,
---Type <return> to continue, or q <return> to quit---    altdest=0x6000000000160f10, completionTag=0x60000fffffb2e96e
"")   at pquery.c:815
 
#8  0x400000000079eed0 in exec_simple_query (    query_string=0x60000000001603b8 "ALTER FOREIGN DATA WRAPPER foo
OPTIONS(a '1', b '2');") at postgres.c:991
 
#9  0x40000000007ab570 in PostgresMain (argc=6, argv=0x60000000000c2ab0,    username=0x60000000000c2800 "math") at
postgres.c:3600
#10 0x40000000006dadb0 in BackendRun (port=0x60000000000e3d40)    at postmaster.c:3258
#11 0x40000000006d8de0 in BackendStartup (port=0x60000000000e3d40)    at postmaster.c:2872
#12 0x40000000006d1700 in ServerLoop () at postmaster.c:1283
#13 0x40000000006d0480 in PostmasterMain (argc=6, argv=0x60000000000c0d20)    at postmaster.c:1031
#14 0x4000000000533e50 in main (argc=6, argv=0x60000000000c0d20) at main.c:188
(gdb)
------------------------

And the full backtrace if needed:

---------------
(gdb) bt full
#0  0x40000000000560b0 in heap_compute_data_size (    tupleDesc=0x200000000287fbb8, values=0x60000000001ae060,
isnull=0x60000000001ae0b8"") at heaptuple.c:103        val = 1761288        data_length = 78        i = 4
numberOfAttributes= 5        att = (Form_pg_attribute *) 0x200000000287fbe0
 
#1  0x400000000005cac0 in heap_form_tuple (tupleDescriptor=0x200000000287fbb8,    values=0x60000000001ae060,
isnull=0x60000000001ae0b8"") at heaptuple.c:728        tuple = (HeapTuple) 0x60000000001adfd0        td =
(HeapTupleHeader)0x60000000001ae0a0        len = 32        data_len = 8        hoff = 32        hasnull = 1 '\001'
 att = (Form_pg_attribute *) 0x200000000287fbe0        numberOfAttributes = 5        i = 5        __func__ =
"heap_form_tuple"
#2  0x400000000005d700 in heap_modify_tuple (tuple=0x600000000019e9f8,    tupleDesc=0x200000000287fbb8,
replValues=0x60000fffffb2e318,   replIsnull=0x60000fffffb2e340 "", doReplace=0x60000fffffb2e345 "")    at
heaptuple.c:853
---Type <return> to continue, or q <return> to quit---        numberOfAttributes = 5        attoff = 5        values =
(Datum*) 0x60000000001ae060        isnull = (bool *) 0x60000000001ae0b8 ""        newTuple = (HeapTuple) 0x91800195972
 
#3  0x4000000000399480 in AlterForeignDataWrapper (stmt=0x6000000000160e78)    at foreigncmds.c:480        rel =
(Relation)0x200000000287f908        tp = (HeapTuple) 0x600000000019e9f8        repl_val = {0, 0, 0, 0, 1761288}
repl_null= "\000\000\000\000"        repl_repl = "\000\000\000\000\001"        fdwId = 28313        isnull = 1 '\001'
    datum = 6917529027642843144        fdwlib = (ForeignDataWrapperLibrary *) 0x600000000016d7f0        __func__ =
"AlterForeignDataWrapper"
#4  0x40000000007b6bc0 in ProcessUtility (parsetree=0x6000000000160e78,    queryString=0x60000000001603b8 "ALTER
FOREIGNDATA WRAPPER foo OPTIONS (a '1', b '2');", params=0x0, isTopLevel=1 '\001', dest=0x6000000000160f10,
completionTag=0x60000fffffb2e96e"") at utility.c:469        __func__ = "ProcessUtility"
 
#5  0x40000000007b2e20 in PortalRunUtility (portal=0x60000000001a5fc8,    utilityStmt=0x6000000000160e78, isTopLevel=1
'\001',
---Type <return> to continue, or q <return> to quit---    dest=0x6000000000160f10, completionTag=0x60000fffffb2e96e "")
  at pquery.c:1183        active_snapshot_set = 1 '\001'        __func__ = "PortalRunUtility"
 
#6  0x40000000007b3380 in PortalRunMulti (portal=0x60000000001a5fc8,    isTopLevel=1 '\001', dest=0x6000000000160f10,
altdest=0x6000000000160f10,   completionTag=0x60000fffffb2e96e "") at pquery.c:1286        stmt = (Node *)
0x6000000000160e78       stmtlist_item = (ListCell *) 0x6000000000161120
 
#7  0x40000000007b1150 in PortalRun (portal=0x60000000001a5fc8,    count=9223372036854775807, isTopLevel=1 '\001',
dest=0x6000000000160f10,   altdest=0x6000000000160f10, completionTag=0x60000fffffb2e96e "")    at pquery.c:815
save_exception_stack= (sigjmp_buf *) 0x60000fffffb2eac0        save_context_stack = (ErrorContextCallback *) 0x0
local_sigjmp_buf= {{__jmpbuf = {6917546619822073200,      2305843009217053184, 0, 2674341019140927, 0, 0, 0, 0,
4611686018435452112,0, 0, 0, 0, 0, -4611686018427386609, 0, 5832769,      6917537823729074712, 0, 6917546619822073296,
0<repeats 44 times>, 63,      4611686018440740537, 6917529027641081860, 209, 0, 4611686018440740536},
__mask_was_saved= 0, __saved_mask = {__val = {6917529027642472976,        6917529027641081861, 4611686018440948192,
6917529027641081856,       6917529027642472976, 6917529027641081860, 6917529027642527480, 0,
6917529027642022104,6917529027642022104, 80, 6917529027642527504,
 
---Type <return> to continue, or q <return> to quit---        4611686018440740536, 6917529027642527584, 80,
6917529027641081856}}}}       result = 0 '\0'        saveTopTransactionResourceOwner = (ResourceOwner)
0x60000000001855d8       saveTopTransactionContext = (MemoryContext) 0x60000000000e59f0        saveActivePortal =
(Portal)0x0        saveResourceOwner = (ResourceOwner) 0x60000000001855d8        savePortalContext = (MemoryContext)
0x0       saveMemoryContext = (MemoryContext) 0x60000000000e59f0        __func__ = "PortalRun"
 
#8  0x400000000079eed0 in exec_simple_query (    query_string=0x60000000001603b8 "ALTER FOREIGN DATA WRAPPER foo
OPTIONS(a '1', b '2');") at postgres.c:991        parsetree = (Node *) 0x6000000000160e78        portal = (Portal)
0x60000000001a5fc8       snapshot_set = 0 '\0'        commandTag = 0x4000000000cbe750 "ALTER FOREIGN DATA WRAPPER"
 completionTag =
"\000\000Q\000\000\000\000\000\000`\234\002\000\000\000\000\003\026\000\000\000\000000\000\000\000\000\000\000?\003\026\000\000\000\000\000\000\000\017\000\000\0006\000\000\000s\001\001\000?\003\026\000\000"
      querytree_list = (List *) 0x60000000001610e8        plantree_list = (List *) 0x6000000000161148        receiver =
(DestReceiver*) 0x6000000000160f10        format = 0        dest = DestRemote
 
---Type <return> to continue, or q <return> to quit---        oldcontext = (MemoryContext) 0x60000000000e59f0
parsetree_list= (List *) 0x6000000000160ed8        parsetree_item = (ListCell *) 0x6000000000160eb0
save_log_statement_stats= 0 '\0'        was_logged = 0 '\0'        isTopLevel = 1 '\001'        msec_str =
"\000\000\000000\000\000\000\000\000\000\003\026\000\000\000\000000\000\000\000\017\000000\000\000"       __func__ =
"exec_simple_query"
#9  0x40000000007ab570 in PostgresMain (argc=6, argv=0x60000000000c2ab0,    username=0x60000000000c2800 "math") at
postgres.c:3600       query_string = 0x60000000001603b8 "ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');"
flag= -1        dbname = 0x60000000000e3450 "regression"        userDoption = 0x0        secure = 0 '\0'        errs =
0       debug_flag = -1        guc_names = (List *) 0x0        guc_values = (List *) 0x0        ctx = PGC_SUSET
gucsource= PGC_S_CLIENT        am_superuser = 1 '\001'
 
---Type <return> to continue, or q <return> to quit---        firstchar = 81        stack_base = 0 '\0'
input_message= {  data = 0x60000000001603b8 "ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');", len = 55, maxlen
=1024, cursor = 55}        local_sigjmp_buf = {{__jmpbuf = {6917546619822074288,      2305843009217053184, 0,
2674341019124543,0, 0, 0, 0,      4611686018435427728, 0, 0, 0, 0, 0, -4611686018427386867, 0, 5832769,
6917537823729074568,0, 6917546619822074560, 0 <repeats 40 times>,      6917546619822075412, 6917546619822075420,
6917546619822075443,     6917546619822075412, 6917546619822075443, 0, 0, 0, 0, 0},    __mask_was_saved = 1,
__saved_mask= {__val = {18446744066192964099,        6917529027641081856, 0, 6917529027641899184, 352, 512,
6917529027641898808,58, 6752, 8144, 6917529027641899344, 5,        6917529027641873152, 81604378636, 0,
6917529027641081861}}}}       send_ready_for_query = 0 '\0'        __func__ = "PostgresMain"
 
#10 0x40000000006dadb0 in BackendRun (port=0x60000000000e3d40)    at postmaster.c:3258        av = (char **)
0x60000000000c2ab0       maxac = 27        ac = 6        secs = 283072531        usecs = 545137
 
---Type <return> to continue, or q <return> to quit---        protobuf = "-v196608\000\000\000@
(\f\000\000\000\000000(\f\000\000\000\000?\000\000"       i = 6        __func__ = "BackendRun"
 
#11 0x40000000006d8de0 in BackendStartup (port=0x60000000000e3d40)    at postmaster.c:2872        bn = (Backend *)
0x60000000000e3410       pid = 0        __func__ = "BackendStartup"
 
#12 0x40000000006d1700 in ServerLoop () at postmaster.c:1283        port = (Port *) 0x60000000000e3d40        i = 0
  rmask = {fds_bits = {16, 0 <repeats 15 times>}}        selres = 1        readmask = {fds_bits = {16, 0 <repeats 15
times>}}       nSockets = 5        now = 1229757331        last_touch_time = 1229757314        __func__ = "ServerLoop"
 
#13 0x40000000006d0480 in PostmasterMain (argc=6, argv=0x60000000000c0d20)    at postmaster.c:1031        opt = -1
 status = 0        userDoption = 0x60000000000c0e00 "/home/math/pgsql_cvs/pgsql/src/test/re---Type <return> to
continue,or q <return> to quit---
 
gress/./tmp_check/data"        i = 64        __func__ = "PostmasterMain"
#14 0x4000000000533e50 in main (argc=6, argv=0x60000000000c0d20) at main.c:188
No locals.

-----------------


Regards,    Sergey

*******************************************************************
Sergey E. Koposov
Max Planck Institute for Astronomy/Sternberg Astronomical Institute
Tel: +49-6221-528-349
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math@sai.msu.ru


Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
Heikki Linnakangas
Дата:
Tom Lane wrote:
> petere@postgresql.org (Peter Eisentraut) writes:
>> Log Message:
>> -----------
>> SQL/MED catalog manipulation facilities
> 
> The buildfarm says this patch has got serious portability issues.
> 
> grebe, dugong, and ermine are all crashing here:
> 
> --- 109,115 ----
>   (3 rows)
>   
>   ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2');
> ! server closed the connection unexpectedly
> !     This probably means the server terminated abnormally
> !     before or while processing the request.
> ! connection to server was lost
> 
> (Unfortunately I can't reproduce this on any of my own machines.)

Neither can I. All the non-Windows crashes in the buildfarm seem to be 
on 64-bit machines, although not all 64-bit members crash.

The callers of transformGenericOptions-function in foreigncmds.c use 
OidIsValid to check the return value of transformGenericOptions, but it 
returns an array, not an Oid. I committed a fix for that, we'll see if 
it heals the buildfarm.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
Alvaro Herrera
Дата:
Tom Lane wrote:
> petere@postgresql.org (Peter Eisentraut) writes:
> > Log Message:
> > -----------
> > SQL/MED catalog manipulation facilities
> 
> The buildfarm says this patch has got serious portability issues.

FWIW I recently learned that you can set MALLOC_PERTURB_ to a nonzero
value to cause glibc's malloc() to fill memory with the byte value
therein, and clear it with the bitwise inverse on free.  This could be
helpful to find cases of uninitialized memory usage.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
Martin Pihlak
Дата:
Heikki Linnakangas wrote:
> The callers of transformGenericOptions-function in foreigncmds.c use
> OidIsValid to check the return value of transformGenericOptions, but it
> returns an array, not an Oid. I committed a fix for that, we'll see if
> it heals the buildfarm.
>

Thanks for that. There was an additional use of the Datum as Oid in
AlterForeignDataWrapper, namely the assignment to repl_vals.

Another bug was uncovered on orca -- a missing semicolon in gram.y:3004

Fixes attached.

regards,
Martin

*** a/src/backend/commands/foreigncmds.c
--- b/src/backend/commands/foreigncmds.c
***************
*** 466,472 **** AlterForeignDataWrapper(AlterFdwStmt *stmt)
                                          NULL, fdwlib->validateOptionList);

          if (PointerIsValid(DatumGetPointer(datum)))
!             repl_val[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = ObjectIdGetDatum(datum);
          else
              repl_null[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true;

--- 466,472 ----
                                          NULL, fdwlib->validateOptionList);

          if (PointerIsValid(DatumGetPointer(datum)))
!             repl_val[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = datum;
          else
              repl_null[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true;

*** a/src/backend/parser/gram.y
--- b/src/backend/parser/gram.y
***************
*** 3001,3007 **** CreateUserMappingStmt: CREATE USER MAPPING FOR auth_ident SERVER name create_gen
  auth_ident:
              CURRENT_USER     { $$ = "current_user"; }
          |    USER            { $$ = "current_user"; }
!         |    RoleId             { $$ = (strcmp($1, "public") == 0) ? NULL : $1 }
          ;

  /*****************************************************************************
--- 3001,3007 ----
  auth_ident:
              CURRENT_USER     { $$ = "current_user"; }
          |    USER            { $$ = "current_user"; }
!         |    RoleId             { $$ = (strcmp($1, "public") == 0) ? NULL : $1; }
          ;

  /*****************************************************************************

Re: [COMMITTERS] pgsql: SQL/MED catalog manipulation facilities This doesn't do any

От
Tom Lane
Дата:
Martin Pihlak <martin.pihlak@gmail.com> writes:
> Thanks for that. There was an additional use of the Datum as Oid in
> AlterForeignDataWrapper, namely the assignment to repl_vals.

Ah, I just finished rediscovering that myself.

> Another bug was uncovered on orca -- a missing semicolon in gram.y:3004

Yeah, newer bisons are pickier about that.  Will apply.
        regards, tom lane