Re: Async branch documentation and review
Jan UrbaĆski <[email protected]> Sun, 11 Apr 2010 04:04:01 +0200
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/04/10 03:11, Daniele Varrazzo wrote: > On Thu, Apr 8, 2010 at 1:33 PM, Daniele Varrazzo > <[email protected]> wrote: > sorry to bother you again :) but I've found another problem. I've > committed a test for it in the above branch (595dc7ef). Ooops, my bad. What was happening is that after the cursor managed to push the whole query to the server it was not setting the status to ASYNC_READ. So after sending the query and doing PQflush once it was returning POLL_WRITE, after doing one poll() it was flushing the rest of the output and returning POLL_READ, but the status was being left as ASYNC_WRITE, so after the next poll() the code was taking the curs_poll_send() branch and trying to flush the output, seeing that it's completely flushed and returning POLL_READ... Which resulted in a busy loop taking 100% CPU. I fixed it, and also added a ASYNC_DONE status to clearly indicate that the async execution has ended, plus some comments. The actual fix is a one line self->conn->async_status = ASYNC_READ that I forgot :( > Reading the code, I also see (pqpath.c, line 741) that you (or maybe > fog before you) check PQpath to be only 0 or !=0: you should probably > also check between 1 (retry) or -1 (hard error). It shouldn't be > related to this bug anyway. Yeah, but it was still wrong. Fixed that too and pushed both fixes to the async_fixes branch. Thanks! Jan