diff options
author | Yorhel <git@yorhel.nl> | 2009-11-04 15:03:37 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-11-04 15:09:54 +0100 |
commit | deadbc57d9c4fe10112cc91d5813e8acd4196abf (patch) | |
tree | a1d4655903d342895f15bdd192a6fb301bb3ec08 | |
parent | 4e000d97b6667daccf21e9f3765428cbba4512b4 (diff) |
This is actually caused by two bugs:
- The query that caused the error is not removed from the queue, so it
will be executed again. (triggering another error)
- The select_write() is still active on the socket, even when we don't
have anything to write.
I've been aware of this bug for quite a while, but could never track it
down. Now I finally know what really happened when my applications got
in an infinite loop.
-rw-r--r-- | lib/POE/Component/Pg.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/POE/Component/Pg.pm b/lib/POE/Component/Pg.pm index a68966b..a31b6b5 100644 --- a/lib/POE/Component/Pg.pm +++ b/lib/POE/Component/Pg.pm @@ -296,13 +296,16 @@ sub dbi_canwrite { $_[HEAP]{q}->execute($item->[QPARAM] && ref($item->[QPARAM]) eq 'ARRAY' ? @{$item->[QPARAM]} : ()); }; + # no need to write anymore + $_[KERNEL]->select_pause_write($_[HEAP]{fh}); + # send error or enter read state if($@) { sendevent \@_, 'error', $item->[QACT], $@, $item->[QQUERY], $item->[QPARAM], $item->[QSESID], $item->[QARG]; + shift @{$_[HEAP]{queue}}; $_[KERNEL]->call($_[SESSION], 'process_queue'); } else { $_[HEAP]{state} = 2; - $_[KERNEL]->select_pause_write($_[HEAP]{fh}); } } |