]> git.mxchange.org Git - friendica.git/blob - include/poller.php
8f9f5aa24debfd6599916d713cdeb26f9c04db2e
[friendica.git] / include / poller.php
1 <?php
2 if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
3         $directory = dirname($_SERVER["argv"][0]);
4
5         if (substr($directory, 0, 1) != "/")
6                 $directory = $_SERVER["PWD"]."/".$directory;
7
8         $directory = realpath($directory."/..");
9
10         chdir($directory);
11 }
12
13 use \Friendica\Core\Config;
14
15 require_once("boot.php");
16
17 function poller_run($argv, $argc){
18         global $a, $db;
19
20         if(is_null($a)) {
21                 $a = new App;
22         }
23
24         if(is_null($db)) {
25                 @include(".htconfig.php");
26                 require_once("include/dba.php");
27                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
28                 unset($db_host, $db_user, $db_pass, $db_data);
29         };
30
31         Config::load();
32
33         // Quit when in maintenance
34         if (Config::get('system', 'maintenance', true)) {
35                 return;
36         }
37
38         $a->set_baseurl(Config::get('system', 'url'));
39
40         load_hooks();
41
42         $a->start_process();
43
44         if ($a->min_memory_reached()) {
45                 return;
46         }
47
48         if (poller_max_connections_reached()) {
49                 return;
50         }
51
52         if ($a->maxload_reached()) {
53                 return;
54         }
55
56         if(($argc <= 1) OR ($argv[1] != "no_cron")) {
57                 poller_run_cron();
58         }
59
60         if ($a->max_processes_reached()) {
61                 return;
62         }
63
64         // Checking the number of workers
65         if (poller_too_much_workers()) {
66                 poller_kill_stale_workers();
67                 return;
68         }
69
70         $starttime = time();
71
72         while ($r = poller_worker_process()) {
73
74                 // Check free memory
75                 if ($a->min_memory_reached()) {
76                         return;
77                 }
78
79                 // Count active workers and compare them with a maximum value that depends on the load
80                 if (poller_too_much_workers()) {
81                         return;
82                 }
83
84                 if (!poller_execute($r[0])) {
85                         return;
86                 }
87
88                 // Quit the poller once every hour
89                 if (time() > ($starttime + 3600))
90                         return;
91         }
92
93 }
94
95 /**
96  * @brief Execute a worker entry
97  *
98  * @param array $queue Workerqueue entry
99  *
100  * @return boolean "true" if further processing should be stopped
101  */
102 function poller_execute($queue) {
103
104         $a = get_app();
105
106         $mypid = getmypid();
107
108         // Quit when in maintenance
109         if (Config::get('system', 'maintenance', true)) {
110                 return false;
111         }
112
113         // Constantly check the number of parallel database processes
114         if ($a->max_processes_reached()) {
115                 return false;
116         }
117
118         // Constantly check the number of available database connections to let the frontend be accessible at any time
119         if (poller_max_connections_reached()) {
120                 return false;
121         }
122
123         $upd = q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = %d WHERE `id` = %d AND `pid` = 0",
124                 dbesc(datetime_convert()),
125                 intval($mypid),
126                 intval($queue["id"]));
127
128         if (!$upd) {
129                 logger("Couldn't update queue entry ".$queue["id"]." - skip this execution", LOGGER_DEBUG);
130                 q("COMMIT");
131                 return true;
132         }
133
134         // Assure that there are no tasks executed twice
135         $id = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
136         if (!$id) {
137                 logger("Queue item ".$queue["id"]." vanished - skip this execution", LOGGER_DEBUG);
138                 q("COMMIT");
139                 return true;
140         } elseif ((strtotime($id[0]["executed"]) <= 0) OR ($id[0]["pid"] == 0)) {
141                 logger("Entry for queue item ".$queue["id"]." wasn't stored - skip this execution", LOGGER_DEBUG);
142                 q("COMMIT");
143                 return true;
144         } elseif ($id[0]["pid"] != $mypid) {
145                 logger("Queue item ".$queue["id"]." is to be executed by process ".$id[0]["pid"]." and not by me (".$mypid.") - skip this execution", LOGGER_DEBUG);
146                 q("COMMIT");
147                 return true;
148         }
149         q("COMMIT");
150
151         $argv = json_decode($queue["parameter"]);
152
153         // Check for existance and validity of the include file
154         $include = $argv[0];
155
156         if (!validate_include($include)) {
157                 logger("Include file ".$argv[0]." is not valid!");
158                 q("DELETE FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
159                 return true;
160         }
161
162         require_once($include);
163
164         $funcname = str_replace(".php", "", basename($argv[0]))."_run";
165
166         if (function_exists($funcname)) {
167
168                 poller_exec_function($queue, $funcname, $argv);
169
170                 q("DELETE FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
171         } else {
172                 logger("Function ".$funcname." does not exist");
173         }
174
175         return true;
176 }
177
178 /**
179  * @brief Execute a function from the queue
180  *
181  * @param array $queue Workerqueue entry
182  * @param string $funcname name of the function
183  * @param array $argv Array of values to be passed to the function
184  */
185 function poller_exec_function($queue, $funcname, $argv) {
186
187         $a = get_app();
188
189         $mypid = getmypid();
190
191         $argc = count($argv);
192
193         logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." ".$queue["parameter"]);
194
195         $stamp = (float)microtime(true);
196
197         // We use the callstack here to analyze the performance of executed worker entries.
198         // For this reason the variables have to be initialized.
199         if (Config::get("system", "profiler")) {
200                 $a->performance["start"] = microtime(true);
201                 $a->performance["database"] = 0;
202                 $a->performance["database_write"] = 0;
203                 $a->performance["network"] = 0;
204                 $a->performance["file"] = 0;
205                 $a->performance["rendering"] = 0;
206                 $a->performance["parser"] = 0;
207                 $a->performance["marktime"] = 0;
208                 $a->performance["markstart"] = microtime(true);
209                 $a->callstack = array();
210         }
211
212         // For better logging create a new process id for every worker call
213         // But preserve the old one for the worker
214         $old_process_id = $a->process_id;
215         $a->process_id = uniqid("wrk", true);
216
217         $funcname($argv, $argc);
218
219         $a->process_id = $old_process_id;
220
221         $duration = number_format(microtime(true) - $stamp, 3);
222
223         if ($duration > 3600) {
224                 logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", LOGGER_DEBUG);
225         } elseif ($duration > 600) {
226                 logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
227         } elseif ($duration > 300) {
228                 logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
229         } elseif ($duration > 120) {
230                 logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
231         }
232
233         logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds.");
234
235         // Write down the performance values into the log
236         if (Config::get("system", "profiler")) {
237                 $duration = microtime(true)-$a->performance["start"];
238
239                 if (Config::get("rendertime", "callstack")) {
240                         if (isset($a->callstack["database"])) {
241                                 $o = "\nDatabase Read:\n";
242                                 foreach ($a->callstack["database"] AS $func => $time) {
243                                         $time = round($time, 3);
244                                         if ($time > 0)
245                                                 $o .= $func.": ".$time."\n";
246                                 }
247                         }
248                         if (isset($a->callstack["database_write"])) {
249                                 $o .= "\nDatabase Write:\n";
250                                 foreach ($a->callstack["database_write"] AS $func => $time) {
251                                         $time = round($time, 3);
252                                         if ($time > 0)
253                                                 $o .= $func.": ".$time."\n";
254                                 }
255                         }
256                         if (isset($a->callstack["network"])) {
257                                 $o .= "\nNetwork:\n";
258                                 foreach ($a->callstack["network"] AS $func => $time) {
259                                         $time = round($time, 3);
260                                         if ($time > 0)
261                                                 $o .= $func.": ".$time."\n";
262                                 }
263                         }
264                 } else {
265                         $o = '';
266                 }
267
268                 logger("ID ".$queue["id"].": ".$funcname.": ".sprintf("DB: %s/%s, Net: %s, I/O: %s, Other: %s, Total: %s".$o,
269                         number_format($a->performance["database"] - $a->performance["database_write"], 2),
270                         number_format($a->performance["database_write"], 2),
271                         number_format($a->performance["network"], 2),
272                         number_format($a->performance["file"], 2),
273                         number_format($duration - ($a->performance["database"] + $a->performance["network"] + $a->performance["file"]), 2),
274                         number_format($duration, 2)),
275                         LOGGER_DEBUG);
276         }
277
278         $cooldown = Config::get("system", "worker_cooldown", 0);
279
280         if ($cooldown > 0) {
281                 logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - in cooldown for ".$cooldown." seconds");
282                 sleep($cooldown);
283         }
284 }
285
286 /**
287  * @brief Checks if the number of database connections has reached a critical limit.
288  *
289  * @return bool Are more than 3/4 of the maximum connections used?
290  */
291 function poller_max_connections_reached() {
292
293         // Fetch the max value from the config. This is needed when the system cannot detect the correct value by itself.
294         $max = Config::get("system", "max_connections");
295
296         // Fetch the percentage level where the poller will get active
297         $maxlevel = Config::get("system", "max_connections_level", 75);
298
299         if ($max == 0) {
300                 // the maximum number of possible user connections can be a system variable
301                 $r = q("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
302                 if ($r)
303                         $max = $r[0]["Value"];
304
305                 // Or it can be granted. This overrides the system variable
306                 $r = q("SHOW GRANTS");
307                 if ($r)
308                         foreach ($r AS $grants) {
309                                 $grant = array_pop($grants);
310                                 if (stristr($grant, "GRANT USAGE ON"))
311                                         if (preg_match("/WITH MAX_USER_CONNECTIONS (\d*)/", $grant, $match))
312                                                 $max = $match[1];
313                         }
314         }
315
316         // If $max is set we will use the processlist to determine the current number of connections
317         // The processlist only shows entries of the current user
318         if ($max != 0) {
319                 $r = q("SHOW PROCESSLIST");
320                 if (!dbm::is_result($r))
321                         return false;
322
323                 $used = count($r);
324
325                 logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
326
327                 $level = ($used / $max) * 100;
328
329                 if ($level >= $maxlevel) {
330                         logger("Maximum level (".$maxlevel."%) of user connections reached: ".$used."/".$max);
331                         return true;
332                 }
333         }
334
335         // We will now check for the system values.
336         // This limit could be reached although the user limits are fine.
337         $r = q("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
338         if (!$r)
339                 return false;
340
341         $max = intval($r[0]["Value"]);
342         if ($max == 0)
343                 return false;
344
345         $r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
346         if (!$r)
347                 return false;
348
349         $used = intval($r[0]["Value"]);
350         if ($used == 0)
351                 return false;
352
353         logger("Connection usage (system values): ".$used."/".$max, LOGGER_DEBUG);
354
355         $level = $used / $max * 100;
356
357         if ($level < $maxlevel)
358                 return false;
359
360         logger("Maximum level (".$level."%) of system connections reached: ".$used."/".$max);
361         return true;
362 }
363
364 /**
365  * @brief fix the queue entry if the worker process died
366  *
367  */
368 function poller_kill_stale_workers() {
369         $r = q("SELECT `pid`, `executed`, `priority`, `parameter` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));
370
371         if (!dbm::is_result($r)) {
372                 // No processing here needed
373                 return;
374         }
375
376         foreach ($r AS $pid) {
377                 if (!posix_kill($pid["pid"], 0)) {
378                         q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
379                                 dbesc(NULL_DATE), intval($pid["pid"]));
380                 } else {
381                         // Kill long running processes
382
383                         // Check if the priority is in a valid range
384                         if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE)))
385                                 $pid["priority"] = PRIORITY_MEDIUM;
386
387                         // Define the maximum durations
388                         $max_duration_defaults = array(PRIORITY_CRITICAL => 360, PRIORITY_HIGH => 10, PRIORITY_MEDIUM => 60, PRIORITY_LOW => 180, PRIORITY_NEGLIGIBLE => 360);
389                         $max_duration = $max_duration_defaults[$pid["priority"]];
390
391                         $argv = json_decode($pid["parameter"]);
392                         $argv[0] = basename($argv[0]);
393
394                         // How long is the process already running?
395                         $duration = (time() - strtotime($pid["executed"])) / 60;
396                         if ($duration > $max_duration) {
397                                 logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") took more than ".$max_duration." minutes. It will be killed now.");
398                                 posix_kill($pid["pid"], SIGTERM);
399
400                                 // We killed the stale process.
401                                 // To avoid a blocking situation we reschedule the process at the beginning of the queue.
402                                 // Additionally we are lowering the priority.
403                                 q("UPDATE `workerqueue` SET `executed` = '%s', `created` = '%s',
404                                                         `priority` = %d, `pid` = 0 WHERE `pid` = %d",
405                                         dbesc(NULL_DATE),
406                                         dbesc(datetime_convert()),
407                                         intval(PRIORITY_NEGLIGIBLE),
408                                         intval($pid["pid"]));
409                         } else {
410                                 logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
411                         }
412                 }
413         }
414 }
415
416 /**
417  * @brief Checks if the number of active workers exceeds the given limits
418  *
419  * @return bool Are there too much workers running?
420  */
421 function poller_too_much_workers() {
422         $queues = Config::get("system", "worker_queues", 4);
423
424         $maxqueues = $queues;
425
426         $active = poller_active_workers();
427
428         // Decrease the number of workers at higher load
429         $load = current_load();
430         if($load) {
431                 $maxsysload = intval(Config::get("system", "maxloadavg", 50));
432
433                 $maxworkers = $queues;
434
435                 // Some magical mathemathics to reduce the workers
436                 $exponent = 3;
437                 $slope = $maxworkers / pow($maxsysload, $exponent);
438                 $queues = ceil($slope * pow(max(0, $maxsysload - $load), $exponent));
439
440                 $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE));
441                 $entries = $s[0]["total"];
442
443                 if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($entries > 0) AND ($active >= $queues)) {
444                         $s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE));
445                         $top_priority = $s[0]["priority"];
446
447                         $s = q("SELECT `id` FROM `workerqueue` WHERE `priority` <= %d AND `executed` > '%s' LIMIT 1",
448                                 intval($top_priority), dbesc(NULL_DATE));
449                         $high_running = dbm::is_result($s);
450
451                         if (!$high_running AND ($top_priority > PRIORITY_UNDEFINED) AND ($top_priority < PRIORITY_NEGLIGIBLE)) {
452                                 logger("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
453                                 $queues = $active + 1;
454                         }
455                 }
456
457                 // Create a list of queue entries grouped by their priority
458                 $running = array(PRIORITY_CRITICAL => 0,
459                                 PRIORITY_HIGH => 0,
460                                 PRIORITY_MEDIUM => 0,
461                                 PRIORITY_LOW => 0,
462                                 PRIORITY_NEGLIGIBLE => 0);
463
464                 $r = q("SELECT COUNT(*) AS `running`, `priority` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` GROUP BY `priority`");
465                 if (dbm::is_result($r))
466                         foreach ($r AS $process)
467                                 $running[$process["priority"]] = $process["running"];
468
469                 $processlist = "";
470                 $r = q("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` GROUP BY `priority`");
471                 if (dbm::is_result($r))
472                         foreach ($r as $entry) {
473                                 if ($processlist != "")
474                                         $processlist .= ", ";
475                                 $processlist .= $entry["priority"].":".$running[$entry["priority"]]."/".$entry["entries"];
476                         }
477
478                 logger("Load: ".$load."/".$maxsysload." - processes: ".$active."/".$entries." (".$processlist.") - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
479
480                 // Are there fewer workers running as possible? Then fork a new one.
481                 if (!Config::get("system", "worker_dont_fork") AND ($queues > ($active + 1)) AND ($entries > 1)) {
482                         logger("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
483                         $args = array("include/poller.php", "no_cron");
484                         $a = get_app();
485                         $a->proc_run($args);
486                 }
487         }
488
489         return($active >= $queues);
490 }
491
492 /**
493  * @brief Returns the number of active poller processes
494  *
495  * @return integer Number of active poller processes
496  */
497 function poller_active_workers() {
498         $workers = q("SELECT COUNT(*) AS `processes` FROM `process` WHERE `command` = 'poller.php'");
499
500         return($workers[0]["processes"]);
501 }
502
503 /**
504  * @brief Check if we should pass some slow processes
505  *
506  * When the active processes of the highest priority are using more than 2/3
507  * of all processes, we let pass slower processes.
508  *
509  * @param string $highest_priority Returns the currently highest priority
510  * @return bool We let pass a slower process than $highest_priority
511  */
512 function poller_passing_slow(&$highest_priority) {
513
514         $highest_priority = 0;
515
516         $r = q("SELECT `priority`
517                 FROM `process`
518                 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`");
519
520         // No active processes at all? Fine
521         if (!dbm::is_result($r))
522                 return(false);
523
524         $priorities = array();
525         foreach ($r AS $line)
526                 $priorities[] = $line["priority"];
527
528         // Should not happen
529         if (count($priorities) == 0)
530                 return(false);
531
532         $highest_priority = min($priorities);
533
534         // The highest process is already the slowest one?
535         // Then we quit
536         if ($highest_priority == PRIORITY_NEGLIGIBLE)
537                 return(false);
538
539         $high = 0;
540         foreach ($priorities AS $priority)
541                 if ($priority == $highest_priority)
542                         ++$high;
543
544         logger("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
545         $passing_slow = (($high/count($priorities)) > (2/3));
546
547         if ($passing_slow)
548                 logger("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
549
550         return($passing_slow);
551 }
552
553 /**
554  * @brief Returns the next worker process
555  *
556  * @return string SQL statement
557  */
558 function poller_worker_process() {
559
560         q("START TRANSACTION;");
561
562         // Check if we should pass some low priority process
563         $highest_priority = 0;
564
565         if (poller_passing_slow($highest_priority)) {
566                 // Are there waiting processes with a higher priority than the currently highest?
567                 $r = q("SELECT * FROM `workerqueue`
568                                 WHERE `executed` <= '%s' AND `priority` < %d
569                                 ORDER BY `priority`, `created` LIMIT 1",
570                                 dbesc(NULL_DATE),
571                                 intval($highest_priority));
572                 if (dbm::is_result($r)) {
573                         return $r;
574                 }
575                 // Give slower processes some processing time
576                 $r = q("SELECT * FROM `workerqueue`
577                                 WHERE `executed` <= '%s' AND `priority` > %d
578                                 ORDER BY `priority`, `created` LIMIT 1",
579                                 dbesc(NULL_DATE),
580                                 intval($highest_priority));
581         }
582
583         // If there is no result (or we shouldn't pass lower processes) we check without priority limit
584         if (($highest_priority == 0) OR !dbm::is_result($r)) {
585                 $r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
586         }
587         return $r;
588 }
589
590 /**
591  * @brief Call the front end worker
592  */
593 function call_worker() {
594         if (!Config::get("system", "frontend_worker")) {
595                 return;
596         }
597
598         $url = App::get_baseurl()."/worker";
599         fetch_url($url, false, $redirects, 1);
600 }
601
602 /**
603  * @brief Call the front end worker if there aren't any active
604  */
605 function call_worker_if_idle() {
606         if (!Config::get("system", "frontend_worker")) {
607                 return;
608         }
609
610         // Do we have "proc_open"? Then we can fork the poller
611         if (function_exists("proc_open")) {
612                 // When was the last time that we called the worker?
613                 // Less than one minute? Then we quit
614                 if ((time() - Config::get("system", "worker_started")) < 60) {
615                         return;
616                 }
617
618                 set_config("system", "worker_started", time());
619
620                 // Do we have enough running workers? Then we quit here.
621                 if (poller_too_much_workers()) {
622                         // Cleaning dead processes
623                         poller_kill_stale_workers();
624                         get_app()->remove_inactive_processes();
625
626                         return;
627                 }
628
629                 poller_run_cron();
630
631                 logger('Call poller', LOGGER_DEBUG);
632
633                 $args = array("include/poller.php", "no_cron");
634                 $a = get_app();
635                 $a->proc_run($args);
636                 return;
637         }
638
639         // We cannot execute background processes.
640         // We now run the processes from the frontend.
641         // This won't work with long running processes.
642         poller_run_cron();
643
644         clear_worker_processes();
645
646         $workers = q("SELECT COUNT(*) AS `processes` FROM `process` WHERE `command` = 'worker.php'");
647
648         if ($workers[0]["processes"] == 0) {
649                 call_worker();
650         }
651 }
652
653 /**
654  * @brief Removes long running worker processes
655  */
656 function clear_worker_processes() {
657         $timeout = Config::get("system", "frontend_worker_timeout", 10);
658
659         /// @todo We should clean up the corresponding workerqueue entries as well
660         q("DELETE FROM `process` WHERE `created` < '%s' AND `command` = 'worker.php'",
661                 dbesc(datetime_convert('UTC','UTC',"now - ".$timeout." minutes")));
662 }
663
664 /**
665  * @brief Runs the cron processes
666  */
667 function poller_run_cron() {
668         logger('Add cron entries', LOGGER_DEBUG);
669
670         // Check for spooled items
671         proc_run(PRIORITY_HIGH, "include/spool_post.php");
672
673         // Run the cron job that calls all other jobs
674         proc_run(PRIORITY_MEDIUM, "include/cron.php");
675
676         // Run the cronhooks job separately from cron for being able to use a different timing
677         proc_run(PRIORITY_MEDIUM, "include/cronhooks.php");
678
679         // Cleaning dead processes
680         poller_kill_stale_workers();
681 }
682
683 if (array_search(__file__,get_included_files())===0){
684         poller_run($_SERVER["argv"],$_SERVER["argc"]);
685
686         get_app()->end_process();
687
688         killme();
689 }
690 ?>