Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Polling a Psycopg2 connection
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Frank Smit  
View profile  
 More options Oct 5 2012, 8:58 am
From: Frank Smit <fr...@61924.nl>
Date: Fri, 5 Oct 2012 14:58:19 +0200
Local: Fri, Oct 5 2012 8:58 am
Subject: [tornado] Polling a Psycopg2 connection
Hi,

I've been rewriting Momoko and trying some new things and I
encountered a bug when implementing transactions. I've isolated the
code and reproduce the problem. It's probably me doing something
wrong, but I can't figure out what.

Here is the code:
https://gist.github.com/3839266

After a connection is made, the `io_callback` is called a fe times
(around 5 times). Then a query is made and `io_callback` is called
constantly. It doesn't stop even after the state is `POLL_OK`.

Here is a snippet of the output. The number show the times
`io_callback` has been caled before I aborted the script.

53687 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53688 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53689 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53690 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53691 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53692 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53693 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53694 POLL_OK IOLoop.NONE
Test conn:  <__main__.Connection object at 0x1c4ef90>
53695 POLL_OK IOLoop.NONE

Anyone knows how this fix this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Darnell  
View profile  
 More options Oct 5 2012, 11:54 pm
From: Ben Darnell <b...@bendarnell.com>
Date: Fri, 5 Oct 2012 20:54:25 -0700
Local: Fri, Oct 5 2012 11:54 pm
Subject: Re: [tornado] Polling a Psycopg2 connection
Maybe you need to call io_loop.remove_handler() when the state is
POLL_OK?  The IOLoop always listens for at least ERROR events on all
registered fds (maybe we should just get rid of that NONE constant;
I'm not sure if it ever makes sense).  If you really don't even care
about errors on the connection, removing the handler seems like the
right thing to do.  If the connection was closed I think you'd
continually get ERROR events until you removed the handler.

-Ben


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Smit  
View profile  
 More options Oct 6 2012, 5:58 am
From: Frank Smit <fr...@61924.nl>
Date: Sat, 6 Oct 2012 11:57:59 +0200
Local: Sat, Oct 6 2012 5:57 am
Subject: Re: [tornado] Polling a Psycopg2 connection
I don't know what to say. i just had a type in the callback variable name...

https://gist.github.com/3839266


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »