Hang in pldebugger after git commit : 98a64d0
От | Ashutosh Sharma |
---|---|
Тема | Hang in pldebugger after git commit : 98a64d0 |
Дата | |
Msg-id | CAE9k0PmG8tC27xj5MZ6ZU_C7ua5F=q+YgiOx2cC-pdkRFHKzRw@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Hang in pldebugger after git commit : 98a64d0
(Michael Paquier <michael.paquier@gmail.com>)
|
Список | pgsql-hackers |
<div dir="ltr">Hi All,<br /><br />I have noticed that any SQL query executed immediately after attaching<br />to a particulardebugging target (pldebugger) either takes longer time<br />for execution or it hangs on Windows. I have checkedit on<br />PostgreSQL-9.5 and PostgreSQL-9.6 versions and have found that the<br />issue only exists on 9.6 version.After doing 'git bisect' i found<br />that the following git commit in PostgreSQL-9.6 branch is the culprit.<br /><br/>commit <b>98a64d0bd713cb89e61bef6432befc</b><br />4b7b5da59e<br />Author: Andres Freund <<a href="mailto:andres@anarazel.de">andres@anarazel.de</a>><br/>Date: Mon Mar 21 09:56:39 2016 +0100<br /><br /> IntroduceWaitEventSet API.<br /><br /> Commit ac1d794 ("Make idle backends exit if the postmaster dies.")<br /> introduceda regression on, at least, large linux systems. Constantly<br /> adding the same postmaster_alive_fds to theOSs internal datastructures<br /> for implementing poll/select can cause significant contention; leading<br /> toa performance regression of nearly 3x in one example.<br /><br /> This can be avoided by using e.g. linux' epoll, whichavoids having to<br /> add/remove file descriptors to the wait datastructures at a high rate.<br /> Unfortunatelythe current latch interface makes it hard to allocate any<br /> persistent per-backend resources.<br /><br/> .................<br /><br />Following are the steps to reproduce the issue:<br /><br />1) Download pldebuggerfrom below url and copy it into contrib directory.<br /><br />git clone git://<a href="http://git.postgresql.org/git/pldebugger.git">git.postgresql.org/git/pldebugger.git</a><br/><br />2) Start a new backendsession (psql -d postgres)<br />3) Create a plpgsql function say func1();<br />4) Get the oid of the func1 and enabledebugging of this using pldbgapi function as shown below<br /> <br /> select plpgsql_oid_debug(16487);<br /><br/>5) execute function func1 : select func1();<br /><br />After executing above query we will get the message as belowand<br />terminal will not respond as it will go in listen mode.<br /> NOTICE: PLDBGBREAK:2<br /><br />6) Start anotherbackend session.<br />7) Execute below query.<br /> SELECT * FROM pldbg_attach_to_port(2)<br /> NOTE: We needto extract the port number from step 5 NOTICE message<br />after 'PLDBGBREAK:' string and use as input here.<br /><br/>8) Execute any SQL query now and the problem starts. I have tried with below queries.<br /><br />SELECT 1;<br /> OR<br/>SELECT pg_backend_pid();<br /> OR<br />SELECT FROM pldbg_wait_for_breakpoint(1::INTEGER);<br /><br />....<br/><br /><br />Problem Analysis:<br />-------------------------<br />Allthough i am very new to Windows, i trieddebugging the issue and<br />could find that Backend is not receiving the query executed after<br />"SELECT pldbg_attach_to_port(2)"and is infinitely waiting on<br />"WaitEventSetWaitBlock()" at WaitForMultipleObjects() to read the<br/>input command. Below is the backtrace for the same.<br /><br />postgres.exe!WaitEventSetWaitBlock(WaitEventSet *set, int<br />cur_timeout, WaitEvent * occurred_events, int nevents) Line 1384 +<br />0x2b bytes C<br /> postgres.exe!WaitEventSetWait(WaitEventSet* set, long timeout,<br />WaitEvent * occurred_events, int nevents) Line 936 +0x18 bytes C<br /> postgres.exe!secure_read(Port * port, void * ptr, unsigned __int64<br />len) Line 168 C<br /> postgres.exe!pq_recvbuf() Line 921 + 0x33 bytes C<br /> postgres.exe!pq_getbyte() Line 963 + 0x5 bytes C<br /> postgres.exe!SocketBackend(StringInfoData* inBuf) Line 334 + 0x5 bytes C<br /> postgres.exe!ReadCommand(StringInfoData* inBuf) Line 507 + 0xa bytes C<br /> postgres.exe!PostgresMain(int argc, char ** argv, const char *<br />dbname, const char * username) Line 4004 + 0xd bytes C<br /> postgres.exe!BackendRun(Port *port) Line 4259 C<br /> postgres.exe!SubPostmasterMain(int argc, char * * argv) Line 4750 C<br /> postgres.exe!main(intargc, char * * argv) Line 216 C<br /> postgres.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C<br/> postgres.exe!mainCRTStartup() Line 371 C<br /><br />With Regards,<br /> Ashutosh Sharma<br /> EnterpriseDB: <a href="http://www.enterprisedb.com"rel="noreferrer" target="_blank">http://www.enterprisedb.com</a><br /></div>
В списке pgsql-hackers по дате отправления:
Предыдущее
От: Magnus HaganderДата:
Сообщение: Re: Back-patch use of unnamed POSIX semaphores for Linux?
Следующее
От: Michael PaquierДата:
Сообщение: Re: Quorum commit for multiple synchronous replication.