Commit Graph

2762 Commits

Author SHA1 Message Date
Brion Vibber
6d055ce09e Fix unqueuemanager for updated QueueHandler interface 2010-01-22 13:49:05 -08:00
Brion Vibber
99866a459b Fix for stuck queue messages: wrap processing in stomp transactions so our lack of an ACK if PHP dies actually triggers redelivery.
Previously, messages once delivered would just get stuck in the queue seemingly forever if they never got ACKed.
Note this could lead to partial duplication, for instance if the OMB or Twitter queue handlers die after 1/2 of the outgoing sends.

Recommendations:
* catch exceptions more aggressively within queue handlers (so only PHP fatal errors are likely to kill in the middle)
* for processing that involves sending to multiple clients, consider a second queue similar to the XMPP output, eg for OMB:
 - first queue gets delivery list and builds message data, enqueueing it for each target address
 - second queue can handle each individual outgoing message (and attempt redelivery etc separately)

This would also protect better against a recurring error preventing delivery in the second part, and could spread out any slow sends over multiple threads.
2010-01-22 12:35:05 -08:00
Brion Vibber
0e852def6a XMPP queued output & initial retooling of DB queue manager to support non-Notice objects.
Queue handlers for XMPP individual & firehose output now send their XML stanzas
to another output queue instead of connecting directly to the chat server. This
lets us have as many general processing threads as we need, while all actual
XMPP input and output go through a single daemon with a single connection open.

This avoids problems with multiple connected resources:
* multiple windows shown in some chat clients (psi, gajim, kopete)
* extra load on server
* incoming message delivery forwarding issues

Database changes:
* queue_item drops 'notice_id' in favor of a 'frame' blob.
  This is based on Craig Andrews' work branch to generalize queues to take any
  object, but conservatively leaving out the serialization for now.
  Table updater (preserves any existing queued items) in db/rc3to09.sql

Code changes to watch out for:
* Queue handlers should now define a handle() method instead of handle_notice()
* QueueDaemon and XmppDaemon now share common i/o (IoMaster) and respawning
  thread management (RespawningDaemon) infrastructure.
* The polling XmppConfirmManager has been dropped, as the message is queued
  directly when saving IM settings.
* Enable $config['queue']['debug_memory'] to output current memory usage at
  each run through the event loop to watch for memory leaks

To do:
* Adapt XMPP i/o to component connection mode for multi-site support.
* XMPP input can also be broken out to a queue, which would allow the actual
  notice save etc to be handled by general queue threads.
* Make sure there are no problems with simply pushing serialized Notice objects
  to queues.
* Find a way to improve interactive performance of the database-backed queue
  handler; polling is pretty painful to XMPP.
* Possibly redo the way QueueHandlers are injected into a QueueManager. The
  grouping used to split out the XMPP output queue is a bit awkward.
2010-01-21 22:40:35 -08:00
Brion Vibber
8dafe09ab2 Option to log slow db queries or all db queries
$config['db']['log_queries'] = true; // all
$config['db']['log_slow_queries'] = 10; // queries taking > 10 seconds
2010-01-21 11:07:52 -08:00
Evan Prodromou
c7f14cd777 allow all rights reserved, private data 2010-01-19 00:04:58 -05:00
Evan Prodromou
71f519f64a add event for showing content license in action 2010-01-18 23:25:45 -05:00
Evan Prodromou
21c3e08804 Merge branch 'master' of git@gitorious.org:statusnet/mainline 2010-01-16 07:48:59 -08:00
Evan Prodromou
d6b8b13116 change rc3 to beta3 2010-01-16 07:48:46 -08:00
Brion Vibber
598072468c --xmpp-only hack for queuedaemon.php to run separate queue daemon with only xmpp threads 2010-01-15 11:13:06 -08:00
Brion Vibber
038287c1ff fix for --skip-xmpp hack -- forgot to do it on the ping & confirm handlers 2010-01-14 17:14:41 -08:00
Brion Vibber
58bc33850a temporary --skip-xmpp flag on queuedaemon.php, allows to run queue daemons but skip subscription to xmpp-based queues
(still working on making these behave gracefully when server is down)
2010-01-14 15:32:37 -08:00
Brion Vibber
2f32181c93 Keep handler registration per-site to fix queue registration in mixed config environment 2010-01-14 13:22:33 -08:00
Brion Vibber
8a7171fde6 Don't barf on io loop if xmpp connection failed 2010-01-13 23:38:51 -08:00
Brion Vibber
4b839cfc53 fix for non-% memory soft limit 2010-01-13 21:41:42 -08:00
Brion Vibber
b25deaacea queue daemon fixes: path fix for xmpp, suppress warning in memcached init 2010-01-13 21:24:36 -08:00
Sarven Capadisli
085406ea88 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-14 01:50:21 +00:00
Sarven Capadisli
acc48289e5 Update geo location UI for notice form where the geo data info is only
visible on @title of the enable/disable button.
2010-01-14 01:48:57 +00:00
Evan Prodromou
fba840ed56 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-13 17:30:22 -08:00
Evan Prodromou
52bbb2262a rev version in lib/common.php 2010-01-13 17:29:58 -08:00
Brion Vibber
82e57b6204 Fix for dbqueuehandler: if a queue is unrecognized, discard entries rather than attempting to re-run them forever! 2010-01-13 16:33:03 -08:00
Evan Prodromou
464ce741a4 remove session info in syslog 2010-01-13 16:19:20 -08:00
Brion Vibber
0e1f2d4b47 Fix regressions in XMPP output during inbox refactoring
- NOTICE_INBOX_SOURCE_* constants moved to common.php since Notice_inbox.php not always loaded
- fixed typo in User::staticGet() call which caused user #1 to receive messages once for each subscriber instead of for him/herself
- 'continue' -> 'continue 2' inside switch() statement to fix loop escape (PHP considers switch() a looping construct for break & continue)
2010-01-13 18:17:36 +00:00
Sarven Capadisli
2000d2d36b Added timeout error handling for geo location 2010-01-13 15:36:42 +00:00
Sarven Capadisli
9b2fdefe39 Using a JSON object for NoticeDataGeo text instead 2010-01-13 15:21:43 +00:00
Evan Prodromou
430bd69312 add events for subscribing to people and joining groups 2010-01-13 02:16:13 -08:00
Evan Prodromou
23599da91e refactor jabber broadcast for notice_inbox removal 2010-01-13 01:13:49 -08:00
Evan Prodromou
155e4ef4f3 remove some debugging statements from util.php 2010-01-12 23:58:25 -08:00
Evan Prodromou
cc25d3baf0 ws changes for phpcs 2010-01-12 23:56:21 -08:00
Evan Prodromou
e34ece8b06 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-12 23:25:25 -08:00
Brion Vibber
ec145b73fc Major refactoring of queue handlers to support running multiple sites in one daemon.
Key changes:
* Initialization code moved from common.php to StatusNet class;
  can now switch configurations during runtime.
* As a consequence, configuration files must now be idempotent...
  Be careful with constant, function or class definitions.
* Control structure for daemons/QueueManager/QueueHandler has been refactored;
  the run loop is now managed by IoMaster run via scripts/queuedaemon.php
  IoManager subclasses are woken to handle socket input or polling, and may
  cover multiple sites.
* Plugins can implement notice queue handlers more easily by registering a
  QueueHandler class; no more need to add a daemon.

The new QueueDaemon runs from scripts/queuedaemon.php:

* This replaces most of the old *handler.php scripts; they've been refactored
  to the bare handler classes.
* Spawns multiple child processes to spread load; defaults to CPU count on
  Linux and Mac OS X systems, or override with --threads=N
* When multithreaded, child processes are automatically respawned on failure.
* Threads gracefully shut down and restart when passing a soft memory limit
  (defaults to 90% of memory_limit), limiting damage from memory leaks.
* Support for UDP-based monitoring: http://www.gitorious.org/snqmon

Rough control flow diagram:
QueueDaemon -> IoMaster -> IoManager
                           QueueManager [listen or poll] -> QueueHandler
                           XmppManager [ping & keepalive]
                           XmppConfirmManager [poll updates]

Todo:

* Respawning features not currently available running single-threaded.
* When running single-site, configuration changes aren't picked up.
* New sites or config changes affecting queue subscriptions are not yet
  handled without a daemon restart.
* SNMP monitoring output to integrate with general tools (nagios, ganglia)
* Convert XMPP confirmation message sends to use stomp queue instead of polling
* Convert xmppdaemon.php to IoManager?
* Convert Twitter status, friends import polling daemons to IoManager
* Clean up some error reporting and failure modes
* May need to adjust queue priorities for best perf in backlog/flood cases

Detailed code history available in my daemon-work branch:
http://www.gitorious.org/~brion/statusnet/brion-fixes/commits/daemon-work
2010-01-12 20:45:09 -08:00
Brion Vibber
2b10e359fe Avoid PHP notice when outputting API data for remote users; no $user means no $user->timezone :)
Trying to get property of non-object (/srv/com.leuksman.status/lib/api.php:171)
2010-01-12 12:28:24 -08:00
Evan Prodromou
392bc728c7 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-12 12:11:37 -08:00
Brion Vibber
cbc3c7b141 Ticket 2152: avoid fatal when php.ini disables dl via disabled_functions (function_exists returns false even though it exists and cannot be redefined) 2010-01-12 07:24:43 -08:00
Evan Prodromou
7e5c15fa80 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-11 16:23:48 -08:00
Zach Copley
3a9e24e077 Fix format specifier on page title 2010-01-11 23:21:09 +00:00
Evan Prodromou
57ac912519 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-11 15:12:13 -08:00
Evan Prodromou
5d676352c3 strip out session ID from root URL 2010-01-11 15:09:46 -08:00
Sarven Capadisli
c7b768b4c8 Removed period 2010-01-11 16:33:46 +01:00
Evan Prodromou
8809e577b2 Merge branch 'sessionidparam' into 0.9.x
Conflicts:
	lib/command.php
2010-01-11 00:45:26 -08:00
Evan Prodromou
ae7469a127 accept session from 2010-01-11 08:39:02 +00:00
Evan Prodromou
e0eb51e4bb add session ID to local URL when server parts differ 2010-01-10 23:51:57 -08:00
Evan Prodromou
dd7195346c Sever -> server in error message 2010-01-10 22:59:50 -08:00
Evan Prodromou
ad63a9518c Sever -> server in error message 2010-01-10 22:59:32 -08:00
Evan Prodromou
15b88697a7 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-10 14:18:54 -08:00
Evan Prodromou
866dfa6822 Merge branch 'master' into 0.9.x
Conflicts:
	classes/Memcached_DataObject.php
2010-01-10 14:18:19 -08:00
Evan Prodromou
7aa43f3c93 defaultDesign was undefined; fixed that 2010-01-10 14:10:31 -08:00
Evan Prodromou
6fdd52467d catch exceptions from snapshot 2010-01-10 14:06:52 -08:00
Zach Copley
63eddf216f Fix routes for social graph API methods -- this takes care of Ticket #2151 2010-01-10 14:03:10 -08:00
Evan Prodromou
8cf1ef862d catch exceptions from snapshot 2010-01-10 13:54:26 -08:00
Evan Prodromou
30409f7bad debugging code to find passed-in objects in munge_password 2010-01-10 12:07:49 -08:00