summaryrefslogtreecommitdiff
path: root/lib/POE/Component
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-11-04 15:03:37 +0100
committerYorhel <git@yorhel.nl>2009-11-04 15:09:54 +0100
commitdeadbc57d9c4fe10112cc91d5813e8acd4196abf (patch)
treea1d4655903d342895f15bdd192a6fb301bb3ec08 /lib/POE/Component
parent4e000d97b6667daccf21e9f3765428cbba4512b4 (diff)
Fixed infinite loop bug on SQL error in the canwrite eventHEADmaster
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.
Diffstat (limited to 'lib/POE/Component')
-rw-r--r--lib/POE/Component/Pg.pm5
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});
}
}