Re: Server crash with older tzload library
От | Jeevan Chalke |
---|---|
Тема | Re: Server crash with older tzload library |
Дата | |
Msg-id | be46a4f31003120104q5647d040i121f790f1f098b1a@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Server crash with older tzload library (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Server crash with older tzload library
(Tom Lane <tgl@sss.pgh.pa.us>)
|
Список | pgsql-hackers |
Hi Tom,
--
Jeevan B Chalke
Software Engineer, R&D
EnterpriseDB Corporation
The Enterprise Postgres Company
Phone: +91 20 30589500
Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb
This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.
On Thu, Mar 11, 2010 at 8:29 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Even we were fail to re-produce it always. It is crashing randomly. After debugging, we found following values in tzstate variable when it crashed. So I manually modified it at the beginning of pg_tzset() function.
/* Initialize tzstate with some arbitrary values */
tzstate.goback = 277946440;
tzstate.goahead = 0;
tzstate.ats[0] = 8892;
Also not that, tzstate variable remains uninitialized properly when tzload() call returns -1. To mimic this, I have just renamed posixrules timezone file to something else. So that tzload returns -1. And as tzload can return -1 in any failure case and as we don't have that check at callee side tzstate variable remains uninitialized which leading to a server crash. As above garbage values too leads to a crash.
In summary, following are the steps to re-produce:
- Add above three lines at the beginning of the pg_tzset() function
- make install
- mv install/share/postgresql/timezone/posixrules install/share/postgresql/timezoneposixrules_a (or remove it)
- start the server
- run these two statements on psql prompt
+ SET TimeZone = 'GMT+3:30';
+ SELECT '1969-12-31 20:30:00'::timestamptz;
BTW, after your commit, tzload() function now sets goback and goahead variable to FALSE which fixes the server crash. MemSet in 2010c is just doing it explicitly before calling tzload though.
Thanks for committing the part of the patch which stopped crashing the server with above mentioned steps.
Thanks
Jeevan Chalke <jeevan.chalke@enterprisedb.com> writes:I can't reproduce that:
> While setting timezone using SET command (say GMT+3:30), postgres sometimes
> crashes randomly.
regression=# SET TimeZone = 'GMT+3:30';
SET
regression=# SELECT '1969-12-31 20:30:00'::timestamptz;
timestamptz
---------------------------
1969-12-31 20:30:00-03:30
(1 row)
Even we were fail to re-produce it always. It is crashing randomly. After debugging, we found following values in tzstate variable when it crashed. So I manually modified it at the beginning of pg_tzset() function.
/* Initialize tzstate with some arbitrary values */
tzstate.goback = 277946440;
tzstate.goahead = 0;
tzstate.ats[0] = 8892;
Also not that, tzstate variable remains uninitialized properly when tzload() call returns -1. To mimic this, I have just renamed posixrules timezone file to something else. So that tzload returns -1. And as tzload can return -1 in any failure case and as we don't have that check at callee side tzstate variable remains uninitialized which leading to a server crash. As above garbage values too leads to a crash.
In summary, following are the steps to re-produce:
- Add above three lines at the beginning of the pg_tzset() function
- make install
- mv install/share/postgresql/timezone/posixrules install/share/postgresql/timezoneposixrules_a (or remove it)
- start the server
- run these two statements on psql prompt
+ SET TimeZone = 'GMT+3:30';
+ SELECT '1969-12-31 20:30:00'::timestamptz;
BTW, after your commit, tzload() function now sets goback and goahead variable to FALSE which fixes the server crash. MemSet in 2010c is just doing it explicitly before calling tzload though.
Thanks for committing the part of the patch which stopped crashing the server with above mentioned steps.
Thanks
regards, tom lane
--
Jeevan B Chalke
Software Engineer, R&D
EnterpriseDB Corporation
The Enterprise Postgres Company
Phone: +91 20 30589500
Website: www.enterprisedb.com
EnterpriseDB Blog: http://blogs.enterprisedb.com/
Follow us on Twitter: http://www.twitter.com/enterprisedb
This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.
В списке pgsql-hackers по дате отправления: