pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec
3+ messages / 2 participants
[nested] [flat]

* NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec
@ 2014-06-13 05:40 Craig Ringer <craig@2ndquadrant.com>
  2014-06-13 15:52 ` Re: NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Inoue, Hiroshi <inoue@tpf.co.jp>
  0 siblings, 1 reply; 3+ messages in thread

From: Craig Ringer @ 2014-06-13 05:40 UTC (permalink / raw)
  To: pgsql-odbc

Hi folks

I've been chasing an NPE in psqlODBC while attempting to run a debug
build to help identify an MSDTC / XA issue for a customer.

In pgenlista.dll, IAsyncPG::RequestExec calls SetDone(...), which clears
the IAsyncPG::dtcconn member. It then calls PgDtc_set_property on the
just-cleared dtcconn member, causing an NPE.

in msdtc_enlist.cpp:

 if (S_OK != res)
 {
 	SetDone(res);
 	bReleaseEnlist = true;
 }
 PgDtc_set_property(dtcconn, prepareRequested, (void *) 0);


At the entry point to IAsyncPG::RequestExec, res == S_OK . It gets set
to S_FAIL at:

    if (!PgDtc_two_phase_operation(econn, PREPARE_TRANSACTION, pgxid))
        res = E_FAIL;

on line 637. I'll look into why that's failing in my environment, but
meanwhile, any attempt to access 'dtcconn' after clearing it is clearly
a bug.

Presumably the PgDtc_set_property should be done before SetDone, or in
an else {} .

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec
  2014-06-13 05:40 NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Craig Ringer <craig@2ndquadrant.com>
@ 2014-06-13 15:52 ` Inoue, Hiroshi <inoue@tpf.co.jp>
  2014-06-14 09:16   ` Re: NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Craig Ringer <craig@2ndquadrant.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Inoue, Hiroshi @ 2014-06-13 15:52 UTC (permalink / raw)
  To: Craig Ringer <craig@2ndquadrant.com>; pgsql-odbc

Hi Craig,

(2014/06/13 14:40), Craig Ringer wrote:
> Hi folks
>
> I've been chasing an NPE in psqlODBC while attempting to run a debug
> build to help identify an MSDTC / XA issue for a customer.
>
> In pgenlista.dll, IAsyncPG::RequestExec calls SetDone(...), which clears
> the IAsyncPG::dtcconn member. It then calls PgDtc_set_property on the
> just-cleared dtcconn member, causing an NPE.

Oops you are right.
Anyway it would take some time to fix it.
I would have to remember the code first.

Thanks.
Hiroshi Inoue

> in msdtc_enlist.cpp:
>
>   if (S_OK != res)
>   {
>   	SetDone(res);
>   	bReleaseEnlist = true;
>   }
>   PgDtc_set_property(dtcconn, prepareRequested, (void *) 0);
>
>
> At the entry point to IAsyncPG::RequestExec, res == S_OK . It gets set
> to S_FAIL at:
>
>      if (!PgDtc_two_phase_operation(econn, PREPARE_TRANSACTION, pgxid))
>          res = E_FAIL;
>
> on line 637. I'll look into why that's failing in my environment, but
> meanwhile, any attempt to access 'dtcconn' after clearing it is clearly
> a bug.
>
> Presumably the PgDtc_set_property should be done before SetDone, or in
> an else {} .


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec
  2014-06-13 05:40 NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Craig Ringer <craig@2ndquadrant.com>
  2014-06-13 15:52 ` Re: NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Inoue, Hiroshi <inoue@tpf.co.jp>
@ 2014-06-14 09:16   ` Craig Ringer <craig@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Craig Ringer @ 2014-06-14 09:16 UTC (permalink / raw)
  To: Inoue, Hiroshi <inoue@tpf.co.jp>; pgsql-odbc

On 06/13/2014 11:52 PM, Inoue, Hiroshi wrote:
> 
> Oops you are right.
> Anyway it would take some time to fix it.
> I would have to remember the code first.

Yeah, I can imagine you don't poke around in that bit of the code a lot.

The Dtc_set_property call looks like it's just simple cleanup, so I'm
inclined to just shove it in an } else { } block. The cleanup performed
makes no sense if the connection has already been closed.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-06-14 09:16 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 05:40 NPE in psqlodbc30a.dll!PgDtc_set_property caused by pgendlista.dll!IAsyncPG::RequestExec Craig Ringer <craig@2ndquadrant.com>
2014-06-13 15:52 ` Inoue, Hiroshi <inoue@tpf.co.jp>
2014-06-14 09:16   ` Craig Ringer <craig@2ndquadrant.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox