2013-01-01 23:09:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorDeveloperConfigOptions
|
|
|
|
extends PhabricatorApplicationConfigOptions {
|
|
|
|
|
|
|
|
public function getName() {
|
2014-06-09 20:36:49 +02:00
|
|
|
return pht('Developer / Debugging');
|
2013-01-01 23:09:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
2014-06-09 20:36:49 +02:00
|
|
|
return pht('Options for Phabricator developers, including debugging.');
|
2013-01-01 23:09:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getOptions() {
|
|
|
|
return array(
|
|
|
|
$this->newOption('darkconsole.enabled', 'bool', false)
|
2013-01-09 17:14:26 +01:00
|
|
|
->setBoolOptions(
|
2013-01-01 23:09:17 +01:00
|
|
|
array(
|
2014-06-09 20:36:49 +02:00
|
|
|
pht('Enable DarkConsole'),
|
|
|
|
pht('Disable DarkConsole'),
|
2013-01-01 23:09:17 +01:00
|
|
|
))
|
|
|
|
->setSummary(pht("Enable Phabricator's debugging console."))
|
|
|
|
->setDescription(
|
|
|
|
pht(
|
|
|
|
"DarkConsole is a development and profiling tool built into ".
|
|
|
|
"Phabricator's web interface. You should leave it disabled unless ".
|
|
|
|
"you are developing or debugging Phabricator.\n\n".
|
2013-07-28 05:18:58 +02:00
|
|
|
"Once you activate DarkConsole for the install, **you need to ".
|
|
|
|
"enable it for your account before it will actually appear on ".
|
|
|
|
"pages.** You can do this in Settings > Developer Settings.\n\n".
|
2013-01-01 23:09:17 +01:00
|
|
|
"DarkConsole exposes potentially sensitive data (like queries, ".
|
|
|
|
"stack traces, and configuration) so you generally should not ".
|
|
|
|
"turn it on in production.")),
|
|
|
|
$this->newOption('darkconsole.always-on', 'bool', false)
|
2013-01-09 17:14:26 +01:00
|
|
|
->setBoolOptions(
|
2013-01-01 23:09:17 +01:00
|
|
|
array(
|
2014-06-09 20:36:49 +02:00
|
|
|
pht('Always Activate DarkConsole'),
|
|
|
|
pht('Require DarkConsole Activation'),
|
2013-01-01 23:09:17 +01:00
|
|
|
))
|
2014-06-09 20:36:49 +02:00
|
|
|
->setSummary(pht('Activate DarkConsole on every page.'))
|
2013-01-01 23:09:17 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
|
|
|
"This option allows you to enable DarkConsole on every page, ".
|
|
|
|
"even for logged-out users. This is only really useful if you ".
|
|
|
|
"need to debug something on a logged-out page. You should not ".
|
|
|
|
"enable this option in production.\n\n".
|
|
|
|
"You must enable DarkConsole by setting {{darkconsole.enabled}} ".
|
|
|
|
"before this option will have any effect.")),
|
Add an option to make it easier to debug page hangs
Summary:
Fixes T6044. We've had two cases (both the same install, coincidentally) where pages got hung doing too much data fetching.
When pages hang, we don't get a useful stack trace out of them, since nginx, php-fpm, or PHP eventually terminates things in a non-useful way without any diagnostic information.
The second time (the recent Macros issue) I was able to walk the install through removing limits on nginx, php-fpm, php, and eventually getting a profile by letting the page run for several minutes until the request completed. However, this install is exceptionally technically proficient and this was still a big pain for everyone, and this approach would not have worked if the page actually looped rather than just taking a long time.
Provide `debug.time-limit`, which should give us a better tool for reacting to this situation: by setting it to a small value (like 10), we'll kill the page after 10 seconds with a trace, before nginx/php-fpm/php/etc can kill it uselessly. Hopefully that will be enough information to find the issue (generally, getting a trace has been 95% of the problem in the two cases we've encountered).
Test Plan: Set this option to `3` and added a sleep loop, saw a termination after 3 seconds with a useful trace.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: csilvers, joshuaspence, epriestley
Maniphest Tasks: T6044
Differential Revision: https://secure.phabricator.com/D10465
2014-09-11 15:28:21 +02:00
|
|
|
$this->newOption('debug.time-limit', 'int', null)
|
|
|
|
->setSummary(
|
|
|
|
pht(
|
|
|
|
'Limit page execution time to debug hangs.'))
|
|
|
|
->setDescription(
|
|
|
|
pht(
|
|
|
|
"This option can help debug pages which are taking a very ".
|
|
|
|
"long time (more than 30 seconds) to render.\n\n".
|
|
|
|
"If a page is slow to render (but taking less than 30 seconds), ".
|
|
|
|
"the best tools to use to figure out why it is slow are usually ".
|
|
|
|
"the DarkConsole service call profiler and XHProf.\n\n".
|
|
|
|
"However, if a request takes a very long time to return, some ".
|
|
|
|
"components (like Apache, nginx, or PHP itself) may abort the ".
|
|
|
|
"request before it finishes. This can prevent you from using ".
|
|
|
|
"profiling tools to understand page performance in detail.\n\n".
|
|
|
|
"In these cases, you can use this option to force the page to ".
|
|
|
|
"abort after a smaller number of seconds (for example, 10), and ".
|
|
|
|
"dump a useful stack trace. This can provide useful information ".
|
|
|
|
"about why a page is hanging.\n\n".
|
|
|
|
"To use this option, set it to a small number (like 10), and ".
|
|
|
|
"reload a hanging page. The page should exit after 10 seconds ".
|
|
|
|
"and give you a stack trace.\n\n".
|
|
|
|
"You should turn this option off (set it to 0) when you are ".
|
|
|
|
"done with it. Leaving it on creates a small amount of overhead ".
|
|
|
|
"for all requests, even if they do not hit the time limit.")),
|
2013-01-01 23:09:17 +01:00
|
|
|
$this->newOption('debug.stop-on-redirect', 'bool', false)
|
2013-01-09 17:14:26 +01:00
|
|
|
->setBoolOptions(
|
2013-01-01 23:09:17 +01:00
|
|
|
array(
|
2014-06-09 20:36:49 +02:00
|
|
|
pht('Stop Before HTTP Redirect'),
|
|
|
|
pht('Use Normal HTTP Redirects'),
|
2013-01-01 23:09:17 +01:00
|
|
|
))
|
|
|
|
->setSummary(
|
|
|
|
pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'Confirm before redirecting so DarkConsole can be examined.'))
|
2013-01-01 23:09:17 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'Normally, Phabricator issues HTTP redirects after a successful '.
|
|
|
|
'POST. This can make it difficult to debug things which happen '.
|
|
|
|
'while processing the POST, because service and profiling '.
|
|
|
|
'information are lost. By setting this configuration option, '.
|
|
|
|
'Phabricator will show a page instead of automatically '.
|
|
|
|
'redirecting, allowing you to examine service and profiling '.
|
|
|
|
'information. It also makes the UX awful, so you should only '.
|
|
|
|
'enable it when debugging.')),
|
2013-01-01 23:09:17 +01:00
|
|
|
$this->newOption('debug.profile-rate', 'int', 0)
|
|
|
|
->addExample(0, pht('No profiling'))
|
|
|
|
->addExample(1, pht('Profile every request (slow)'))
|
|
|
|
->addExample(1000, pht('Profile 0.1%% of all requests'))
|
2014-06-09 20:36:49 +02:00
|
|
|
->setSummary(pht('Automatically profile some percentage of pages.'))
|
2013-01-01 23:09:17 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
|
|
|
"Normally, Phabricator profiles pages only when explicitly ".
|
|
|
|
"requested via DarkConsole. However, it may be useful to profile ".
|
|
|
|
"some pages automatically.\n\n".
|
|
|
|
"Set this option to a positive integer N to profile 1 / N pages ".
|
|
|
|
"automatically. For example, setting it to 1 will profile every ".
|
|
|
|
"page, while setting it to 1000 will profile 1 page per 1000 ".
|
|
|
|
"requests (i.e., 0.1%% of requests).\n\n".
|
|
|
|
"Since profiling is slow and generates a lot of data, you should ".
|
|
|
|
"set this to 0 in production (to disable it) or to a large number ".
|
|
|
|
"(to collect a few samples, if you're interested in having some ".
|
|
|
|
"data to look at eventually). In development, it may be useful to ".
|
|
|
|
"set it to 1 in order to debug performance problems.\n\n".
|
|
|
|
"NOTE: You must install XHProf for profiling to work.")),
|
2013-02-01 18:34:06 +01:00
|
|
|
$this->newOption('phabricator.developer-mode', 'bool', false)
|
2013-01-09 17:14:26 +01:00
|
|
|
->setBoolOptions(
|
2013-01-03 14:46:52 +01:00
|
|
|
array(
|
2013-02-01 18:34:06 +01:00
|
|
|
pht('Enable developer mode'),
|
|
|
|
pht('Disable developer mode'),
|
2013-01-03 14:46:52 +01:00
|
|
|
))
|
2014-06-09 20:36:49 +02:00
|
|
|
->setSummary(pht('Enable verbose error reporting and disk reads.'))
|
2013-02-01 18:34:06 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'This option enables verbose error reporting (stack traces, '.
|
|
|
|
'error callouts) and forces disk reads of static assets on '.
|
|
|
|
'every reload.')),
|
2014-04-10 23:38:23 +02:00
|
|
|
$this->newOption('celerity.minify', 'bool', true)
|
2013-01-09 17:14:26 +01:00
|
|
|
->setBoolOptions(
|
2013-01-03 14:46:52 +01:00
|
|
|
array(
|
|
|
|
pht('Minify static resources.'),
|
2013-01-07 22:50:03 +01:00
|
|
|
pht("Don't minify static resources."),
|
2013-01-03 14:46:52 +01:00
|
|
|
))
|
2014-06-09 20:36:49 +02:00
|
|
|
->setSummary(pht('Minify static Celerity resources.'))
|
2013-01-03 14:46:52 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'Minify static resources by removing whitespace and comments. You '.
|
|
|
|
'should enable this in production, but disable it in '.
|
|
|
|
'development.')),
|
2013-01-14 00:10:31 +01:00
|
|
|
$this->newOption('cache.enable-deflate', 'bool', true)
|
|
|
|
->setBoolOptions(
|
|
|
|
array(
|
2014-06-09 20:36:49 +02:00
|
|
|
pht('Enable deflate compression'),
|
|
|
|
pht('Disable deflate compression'),
|
2013-01-14 00:10:31 +01:00
|
|
|
))
|
|
|
|
->setSummary(
|
2014-06-09 20:36:49 +02:00
|
|
|
pht('Toggle gzdeflate()-based compression for some caches.'))
|
2013-01-14 00:10:31 +01:00
|
|
|
->setDescription(
|
|
|
|
pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'Set this to false to disable the use of gzdeflate()-based '.
|
|
|
|
'compression in some caches. This may give you less performant '.
|
|
|
|
'(but more debuggable) caching.')),
|
2013-01-01 23:09:17 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|