There was a problem with (specifically at least) PuSHpress for
Wordpress. A previous attempt to perform a DB transaction backfired
because the remote side could connect to the callback before our
commit had gone through.
I take full responsibility for introducing the bug in the first place :)
}
$feedsub = FeedSub::getKV('id', $feedid);
}
$feedsub = FeedSub::getKV('id', $feedid);
+ if (!$feedsub instanceof FeedSub) {
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
}
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
}
+ * Setting to subscribe means it is _waiting_ to become active. This
+ * cannot be done in a transaction because there is a chance that the
+ * remote script we're calling (as in the case of PuSHpress) performs
+ * the lookup _while_ we're POSTing data, which means the transaction
+ * never completes (PushcallbackAction gets an 'inactive' state).
+ *
* @return boolean true on successful sub/unsub, false on failure
*/
protected function doSubscribe($mode)
{
* @return boolean true on successful sub/unsub, false on failure
*/
protected function doSubscribe($mode)
{
$orig = clone($this);
if ($mode == 'subscribe') {
$this->secret = common_random_hexstr(32);
$orig = clone($this);
if ($mode == 'subscribe') {
$this->secret = common_random_hexstr(32);
$response = $client->post($hub, $headers, $post);
$status = $response->getStatus();
if ($status == 202) {
$response = $client->post($hub, $headers, $post);
$status = $response->getStatus();
if ($status == 202) {
- $this->query('COMMIT');
common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback');
return true;
} else if ($status >= 200 && $status < 300) {
common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback');
return true;
} else if ($status >= 200 && $status < 300) {
} else {
common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody());
}
} else {
common_log(LOG_ERR, __METHOD__ . ": sub req failed with HTTP $status: " . $response->getBody());
}
- $this->query('ROLLBACK');
- $this->query('ROLLBACK');
// wtf!
common_log(LOG_ERR, __METHOD__ . ": error \"{$e->getMessage()}\" hitting hub $this->huburi subscribing to $this->uri");
// wtf!
common_log(LOG_ERR, __METHOD__ . ": error \"{$e->getMessage()}\" hitting hub $this->huburi subscribing to $this->uri");