jenkins-bot has submitted this change and it was merged.
Change subject: Added $wgRunJobsAsync to allow running jobs the old way
......................................................................
Added $wgRunJobsAsync to allow running jobs the old way
Adding a new global variable (DefaultSettings.php) named $wgRunJobsAsync, that
defaults to true, to allow installations to force the old synchronous job
execution on page requests instead of the new asynchonous one.
The asynchronous job queue execution was added in 1.22, executing a new shell
script, and it caused major problems for third party installations with
restricted
environments or limited system resources, and also because a lot of bugs that
went
unnoticed because WMF wikis do not use the on-request job queue.
In 1.23 it was changed to use a new internal HTTP request to a MediaWiki entry
point
to perform the request, While some of the bugs were solved, it could still have
performance problems for opening a new process and loading a lot of MediaWiki
PHP
objects on it, just to perform a request to see if there are pending jobs and
execute
them (it doesn't check if there are jobs to execute). While this may improve
speed
on single page requests, because it does not block the execution of the current
page,
it has't been thoroughly tested on third party installations. And what is more
important, now there's no way to revert back to the old way of handling those
jobs,
as it was done in 1.22 (setting $wgPhpCli = false). This means, in case of major
bugs on the job queue execution due to the new request, there's no way to fix it
other than editing MediaWiki PHP files directly, or completely disable the
on-request job queue handling (some hosts can't set up a cron job for that)
This situation makes it critical to have a safe way to revert to the old job
queue
handling, at least until testing that the current implementation doesn't break
a lot
of installations.
Bug: 61387
Change-Id: I892a3608228ec0a1c63268fb6180ec679c315980
---
M RELEASE-NOTES-1.23
M includes/DefaultSettings.php
M includes/Wiki.php
3 files changed, 19 insertions(+), 2 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23
index c231db6..44469cb 100644
--- a/RELEASE-NOTES-1.23
+++ b/RELEASE-NOTES-1.23
@@ -11,7 +11,9 @@
=== Configuration changes in 1.23 ===
* When $wgJobRunRate is higher that zero, jobs are now executed via an
asynchronous HTTP request to a MediaWiki entry point. This may require
- increasing the number of server worker threads.
+ increasing the number of server worker threads. $wgRunJobsAsync has been
+ added to disable this feature if needed, falling back to executing the job
+ on the same process but making the execution synchronously.
* $wgDebugLogGroups values may be set to an associative array with a
'destination' key specifying the log destination. The array may also contain
a 'sample' key with a positive integer value N indicating that the log group
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index a3c22b8..5b2360c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -6923,6 +6923,14 @@
$wgJobRunRate = 1;
/**
+ * When $wgJobRunRate > 0, try to run jobs asynchronously, spawning a new
process
+ * to handle the job execution, instead of blocking the request until the job
+ * execution finishes.
+ * @since 1.23
+ */
+$wgRunJobsAsync = true;
+
+/**
* Number of rows to update per job
*/
$wgUpdateRowsPerJob = 500;
diff --git a/includes/Wiki.php b/includes/Wiki.php
index 6cf718c..ccc9b8d 100644
--- a/includes/Wiki.php
+++ b/includes/Wiki.php
@@ -624,7 +624,7 @@
* the socket once it's done.
*/
protected function triggerJobs() {
- global $wgJobRunRate, $wgServer;
+ global $wgJobRunRate, $wgServer, $wgRunJobsAsync;
if ( $wgJobRunRate <= 0 || wfReadOnly() ) {
return;
@@ -644,6 +644,13 @@
$n = intval( $wgJobRunRate );
}
+ if ( !$wgRunJobsAsync ) {
+ // If running jobs asynchronously has been disabled,
run the job here
+ // while the user waits
+ SpecialRunJobs::executeJobs( $n );
+ return;
+ }
+
$query = array( 'title' => 'Special:RunJobs',
'tasks' => 'jobs', 'maxjobs' => $n, 'sigexpiry' =>
time() + 5 );
$query['signature'] = SpecialRunJobs::getQuerySignature( $query
);
--
To view, visit https://gerrit.wikimedia.org/r/124470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I892a3608228ec0a1c63268fb6180ec679c315980
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Martineznovo <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Martineznovo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits