Thread: Server Crash into contrib module ISN into 64bit OS
<br clear="all" />Following test end up with the server crash into 8.4 cvs Head.<br /><br />uname -a<br />Linux localhost.localdomain2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux<br /> <br />Testcasewith ISN contrib module:<br /> =========================<br /><br />CREATE OR REPLACE function isbn_issn_proc()returns void as<br />$$<br />declare<br />v1 isbn;<br />BEGIN<br /> v1 := isbn_in('0-596-00270-x');<br/>END;<br />$$ LANGUAGE plpgsql;<br /><br /> select isbn_issn_proc();<br /><br />Analysis:<br/>=======<br /><br />Found that we are getting crash while doing the memcpy into datumCopy(). <br /><br />Datum<br />datumCopy(Datum value, bool typByVal, int typLen) <br />{ <br />... <br /> if (DatumGetPointer(value)== NULL) <br /> return PointerGetDatum(NULL); <br /><br /> realSize = datumGetSize(value,typByVal, typLen); <br /><br /> s = (char *) palloc(realSize); <br /> memcpy(s, DatumGetPointer(value),realSize); /* crash */<br />} <br /><br /> Actually we get crash while doing the DatumGetPointer(),upon further investigation found that in isbn_in() function we are using PG_RETURN_EAN13(), which seemsto be returning the wrong address in case of 64bit OS.<br /><br />I was wondering that why its happening in PG 8.4;then found that we are having USE_FLOAT8_BYVAL into current version, because of the same not getting correct/expectedDatum representation of the int64. <br /><br />postgres.h <br /><br />#ifdef USE_FLOAT8_BYVAL <br />#defineInt64GetDatum(X) ((Datum) SET_8_BYTES(X)) <br />#else <br />extern Datum Int64GetDatum(int64 X); <br />#endif <br/><br />When I tried the same case with --disable-float8-byval option, test running as expected. <br /><br /><br /><br/>Regards,<br />Rushabh Lathia<br /><br /><a href="http://www.EnterpriseDB.com">www.EnterpriseDB.com</a>
"Rushabh Lathia" <rushabh.lathia@gmail.com> writes: > Following test end up with the server crash into 8.4 cvs Head. Hmm, this'd have been noticed sooner if contrib/isn had even minimal regression tests :-( Anyone feel like writing some? regards, tom lane
I think we need to create ISBN type ( contrib/isn/isn.sql.in) with flag PASSBYVALUE flag when flag USE_FLOAT8_BYVAL is set.
-Regards,
Rushabh
--
Rushabh Lathia
-Regards,
Rushabh
On Fri, Nov 28, 2008 at 10:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Rushabh Lathia" <rushabh.lathia@gmail.com> writes:Hmm, this'd have been noticed sooner if contrib/isn had even
> Following test end up with the server crash into 8.4 cvs Head.
minimal regression tests :-( Anyone feel like writing some?
regards, tom lane
--
Rushabh Lathia