When clicking on "determine default service host" on ./admin/settings/background-process
, I'm getting:
Could not determine default service host. Please configure background process in your settings.php
However I can not find a documentation what is supposed to be configured in settings.php.
That's the setting I have in my settings.php:
$conf['background_process_service_hosts'] = array(
'default' => array(
'base_url' => 'http://xxx.xxx.xxx.xxx',
'http_host' => 'my.site.com',
),
);
Related: #1365058: Error "Could not determine default service host" when running update.php, #14; as Skidz in #14, I'm running Pressflow, but Memcached instead of Varnish.
The problem why I even went to ./admin/settings/background-process
is that I'm trying to run the 'Ultimate Cron' module which does not do anything but report "Starting" the cron tasks. As the FAQ suggests in "Q: Jobs are stuck in "Starting" state": "[…] Another solution could be to manually configure the service hosts in the settings file. See Background Process for more", which leads me back to square one.
Any ideas?
Comment | File | Size | Author |
---|---|---|---|
#21 | cron-overview.jpg | 175.04 KB | asb |
Comments
Comment #1
asb CreditAttribution: asb commentedMaybe related as well: #1906658: Processes remain in "starting" state
Comment #2
gielfeldt CreditAttribution: gielfeldt commentedHi asb
in #1365058: Error "Could not determine default service host" when running update.php #1 is listed the urls Background Process tries when clicked the "Determine default service host". If Background Process is configured in settings.php, then this button has no effect and should not be used.
The problem with the process not starting, try to check the webservers access logs and see if there are any requests made to /bgp-start/..... and which http response code it returns. That should be able to tell us what happens when Background Process tries to start a process. Also the php error logs or webserver error logs may contain useful information.
I've been planning to clean up/refactor all the default service host stuff, and I've also been planning to add some debug/diagnostic tools for Background Process. However, I haven't really around to it yet. Furthermore Background Process 2.x is in the pipeline (have been for quuuuuite some time now), but again; so much to do and so little to do it in :-(
Comment #3
asb CreditAttribution: asb commentedThanks for your fast response!
I got the same error when nothing related to Background Process was configured in settings.php.
I grepped for "bgp-start" through Apache's complete access.log for this site, with zero results. Other sites on the same host do log stuff like:
.. "POST /bgp-start/uc%25253Axmlsitemap_taxonomy_cron/1200f5866cab56cdd08a7ad577a07095 HTTP/1.0" 200 364 "-" ...
However, the site in question does not log anything about "bgp-start". The site is pretty busy, but 'Ultimate Cron' is pretty silent.
Changes I tried:
$base_url
in settings.php,./admin/settings/cron/settings
,./admin/reports/status
reports no errors; manually executed./admin/reports/status/run-cron
; Apache's access.log still does not log anything with "bgp-start". Even if settings.php now has a$base_url
,./admin/settings/background-process
still claims "Could not determine default service host. Please configure background process in your settings.php". According to the post you mentioned, this variable should do the trick. Very weird…I know that feeling… Have you considered cloning? ;-)
Greetings, -asb
Comment #4
gielfeldt CreditAttribution: gielfeldt commentedVery odd that there are no entries en apache's access logs with /bgp-start ... I'll see if I can add some debug/diagnostic parts to Background Process this weekend.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm also seeing this error.
I *was* seeing a calls for "bgp-start", but in the error logs. It's telling me "File does not exist: /cwis/http/htdocs/cpe/bgp-start"
Does that help at all?
Thanks!
Comment #6
gielfeldt CreditAttribution: gielfeldt commentedIs /cwis/http/htdocs/cpe/ your drupal root?
Comment #7
gielfeldt CreditAttribution: gielfeldt commentedI've just made a commit to Background Process 6.x-1.x-dev which logs the attempted request to watchdog debug. Once it's ready for download, could you try installing it and then check your watchdog when Ultimate Cron tries to run a job? You could also checkout the 6.x-1.x branch from git if possible, then you won't have to wait.
Comment #8
asb CreditAttribution: asb commentedThanks for the new dev release. Now I'm getting a massive amount of new entries from 'bg_process' in watchdog log. The messages are arrays like this:
What am I supposed to look for?
Comment #9
gielfeldt CreditAttribution: gielfeldt commentedThe important thing is the url. I assume you've replaced the real hostname with "myhost.com".
Two things we need to clarify:
1.) Which ip's and ports are Apache listening to, and which ip/ports are the vhost "myhost.com" configured to use?
2.) Is the host able to make a hostname lookup for myhost.com on the server? (host myhost.com from the terminal, if you have ssh-access).
Comment #10
asb CreditAttribution: asb commentedYes, I replaced the real hostname with "myhost.com"; I'm not operating the company myhost.com, so let's better call my site "myhost.tld". My site has been online for a couple of years, it has a fair number of visitors and Google Webmaster Tools do not report problems accessing the host. If there'd be a DNS misconfiguration or accessibility problem, Googlebot usually detects and reports it.
The site is hosted on a dedicated server which hosts a dozend Drupal sites, all D6 (actually Pressflow) with similar setups (caching through Memcached, APC and Boost); the system has been set up in 2011 and had no major configuration changes since then (except updates). The operating system is Debian and Apache 2.2.16's vhosts are configured in
/etc/apache2/sites-enabled/
. The server has exactly one IPv4 address that is set up in/etc/network/interfaces
, let's call it 11.22.33.44. The Apache vhost is set up in/etc/apache2/sites-enabled/myhost
, which reads like this:If I am on the remote server and do a hostname lookup for myhost.tld, the local BIND resolves correctly to the server's IP address 11.22.33.44:
I can do the same thing from my local Linux box at home and get the same result by using a different DNS server.
There's always a remote chance of a configuration error, but I in this case there is no indication for a problem. Also it might be noteworthy that I'm regularily working on the site myhost.tld through regular Internet channels and am not encountering any issues with adding/editing content on the site. Also, Drupal's status report does not report any issues, especially not that popular HTTP request failure that would indicate some networking troubles.
Comment #11
gielfeldt CreditAttribution: gielfeldt commentedHi
Sounds very strange. After trying to run a cron job, what happens if you try to access the url http://myhost.tld/bgp-start/ultimate_cron_poorman/cea6db6f113327a67982e7... (from the watchdog) manually?
I've added a diagnostics mode to Background Process and committed to git (enable at /admin/settings/background-process). This will add the response from the http request to the watchdog log. Maybe this can give us some more insight. This option is now also required for the previous addition (logging the requested url to watchdog).
Comment #12
asb CreditAttribution: asb commentedI'll take a recent log entry from watchdog; 'bg_process' logs:
Manually loading
http://myhost.tld/bgp-start/ultimate_cron_poorman/c13d1eaa5946fac232b713fc4bd768ff
results in a blank (white) page. However, this is probably not a WSOD (no corresponding record in Apache's error.log; also, raised PHP memory limit from 400M to 500M with same behaviour).I'll try out the new dev release as it becomes available. Thanks again for your help!
Comment #13
asb CreditAttribution: asb commentedHm... it's logging tons of errors.
"%253A" looks like an encoding problem, probably should be a slash ("/").
The URL it actually tries to access is "http://myhost.tld/bgp-start/uc%25253Apoll_cron/155adfd5a5bd157ba25ac20a2..."
There is an "%25253A", probably should be an underscore ("_").
Disabled "Use double encoding of URLs" at
./admin/settings/background-process/settings
to check if this is an ecoding problem in the code or just in the strings submitted into watchdog.Weird:
The double encodings are gone, but it still doesn't find the URL :-(
Comment #14
gielfeldt CreditAttribution: gielfeldt commentedI just realized something. Could you try changing the prefix on the Ultimate Cron settings page from "uc_" to "uc-"?
Comment #15
asb CreditAttribution: asb commentedThe "Handle prefix" at
./admin/settings/cron/settings
wasuc:
, which should be the default value. Now changed touc-
, ran cron again. Still:Should I try
uc_
(with underscore) as well?Also, it's unclear to me, if the D6 module 'Poorman's Cron' is a hidden dependency, at least I don't have it installed. Disabled "Poormans cron" at
./admin/settings/cron/settings
.Comment #16
gielfeldt CreditAttribution: gielfeldt commentedIt's probably not a WSOD as you say. If the request does complete, it will just return a blank output. However, it could be interesting to see if these manual requests hit the right vhost.
Not necessary. I actually meant changing from "uc:", just to eliminate potential encoding issues.
The poormans cron module should not be installed. Ultimate Cron has it's own poormans cron mechanism.
I wonder where all these background process requests are going, if they're not hitting the vhost configured for your Drupal installation. Can you determine which vhost it's hitting? I assume it's hitting a vhost with the document_root "/cwis/http/htdocs/cpe/" (which I assume is not your Drupal installation?).
Comment #17
asb CreditAttribution: asb commentedI'm afraid these are two somehow different issues. The URL stub you are mentioning (
/cwis/http/htdocs/cpe/bgp-start
) comes from #5, a comment from 'codecrow'.I do not have a similar URL stub in the error messages logged by watchdog (my site lives in
/var/www/mysite
). In my case, valid paths are requested; the requested "files" (like "99ef0a41e051af917da30b0d8e24e700") are simply not there.Comment #18
gielfeldt CreditAttribution: gielfeldt commentedOH, sry :-)
You said in #3 that other sites do show the /bgp-start requests in the access logs. Is it other sites running Ultimate Cron, or is here the myhost.tld requests go?
Try to match the token (e.g. 1200f5866cab56cdd08a7ad577a07095 in this example url) "POST /bgp-start/uc-xmlsitemap_taxonomy_cron/1200f5866cab56cdd08a7ad577a07095 HTTP/1.0"
in the access logs for all the sites to see if it pops up somewhere, and if so for which site.
You could also check the background_process table, to see if it is actually populated with data.
Comment #19
asb CreditAttribution: asb commented> Is it other sites running Ultimate Cron […]
Yes, those are the sites I installed 'Ultimate Cron' first (there it works, same server, similar configuration).
> […] check the background_process table, to see if it is actually populated with data.
1) Table exists:
2) It contains some data (19 records):
The 'uid' colums says UID=0, which is "anon" if I recall correctly. Tried to log in user #1; switched to that account and called
./admin/reports/status/run-cron
,Green box says:
At
./admin/settings/cron
, red box says:38 jobs had errors during their last run
Unlocked a task ('boost_cron'), started it manually:
boost_cron could not start (service unavailable)
Watchdog still logs "Not Found. The requested URL /bgp-start/uc-boost_cron/092ac8e02b2db462eb270a41e3f05906 was not found on this server. Apache/2.2.16 (Debian) Server at mysite.tld Port 80".
Disabled and uninstallted 'Ultimate Cron', then enabled and reinstalled it, same outcome as before.
Comment #20
gielfeldt CreditAttribution: gielfeldt commentedHi asb
Sry for the late reply. I've looked some more into this, and I cannot see why this shouldn't work. Especially since you say you have other sites that are running fine.
Does the string "092ac8e02b2db462eb270a41e3f05906" appear in ANY of the access logs on the server (i.e. for any site/vhost)?
Comment #21
asb CreditAttribution: asb commentedI'll try to summarize what I've tried in the past two weeks. But first I'd like to point out that I'm not trying to use 'Ultimate Cron' just for fun, but because I have ongoing trouble with Drupal core's Cron; 'Ultimate Cron' is definiteley not the reason for those problems, but it doesn't solve them, either (at least not yet).
My assumption from a while ago was: Some job(s) supposed to be executed during Cron runs make the "Cron bundle" (as provided by Drupal core) hang; as long as one site has such a hanging job, the whole Cron daemon might be affected (from my server's syslog I can not diagnose what makes cron to not finalize it's bundles). So I took the whole server and replaced Drupal core's Cron on all Drupal 6 sites (10 sites D6, 1 site D7). On all sites, Ultimate Cron reports an "OK" according to system status, but Cron jobs are not automatically executed (overview attached); the D7 site is marginal (very small, not very busy), but core's Cron works more or less. However, with this attempt I couldn't prove my assumption.
Next I replaced 'Ultimate Cron' on one site with 'Elysia Cron', which partially works better, but doesn't execute Cron Jobs automatically as well. So basically it doesn't matter if I run Drupal core's Cron, 'Elysia Cron' or 'Ultimate Cron' with it's dependencies; the only way to get Cron jobs executed is to call
./admin/reports/status/run-cron
manually (multiple times per day and on every site - great ;)A difference between 'Ultimate Cron' and 'Elysia Cron' appears to be, that the latter seems to actually call the Cron daemon, at least it leaves traces in
/var/log/syslog
:Exit code 8 means: "Crontab has been run with the -u option by a user other than root. Only root is allowed to use this option." I had 'Elysia Cron' installed on another site months ago, got the same error and never managed to fix it; that's thereason why I tried to move to another Cron replacement. Since 'Elysia Cron' didn't resolve the problem I switched back to 'Ultimate Cron' which now rund on all D6 sites on this server. According to my Crontab, every 5-10 minuts Cron should be called. That is not the case, syslog only logs sporadic calls of cron. However, even without 'Elysia Cron', I'm now getting Cron errors like "grandchild #24608 failed with exit status 8" which I need to investigate somehow. However, it's beyond me where Debian stores the root's crontab, who is calling it and why it suddenly & partially stopped working a couple of months ago (I set up those servers over two years ago).
Also I compared the D6 sites on another server; they show similar symptoms (mostly, Cron isn't executed automatically). Sporadically, syslog logs Cron errors over there as well, but slightly different ones: "(CRON) error (grandchild #8750 failed with exit status 4)". Exit code 4 means: "An attempt to run cron has been made by a user who does not have permission to access the crontabs in /var/cron/tabs. These files should be readable only by root, and the cron daemon must be run as root." Following this error fails since /var/cron/tabs does not even exist.
crontab -e
edits a temporary file like /tmp/crontab.Osc0Tl/crontab. Even stranger: Other (non-Drupal-) Cron jobs are executed properly (e.g. creating server statistics through Awstats).Comment #22
gielfeldt CreditAttribution: gielfeldt commentedHi
First of all, if you have both Elysia Cron and Ultimate Cron, you're probably in for a world of problems :-). Especially if the crontab "(root) CMD (wget -O - -q -t 1 http://mysite.tld/sites/all/modules/elysia_cron/cron.php" is running on the site supposed to run Ultimate Cron.
The crontab errors you are mentioning are not Drupal related, and I'm not sure how much help I can be there :-(.
If you're not using multiple web servers to serve your Drupal site, I suggest switching to a Drush based cron run. That will also save you some load on Apache.
I propose the following:
1.) Disable all Drupal related cron jobs on the server (at least for the site in question).
2.) Disable the Elysia Cron module if enabled.
3.) Disable the Poormans cron on the Ultimate Cron settings page.
4.) Install Drush (if you haven't already done so).
5.) To try it out, cd to your drupal folder and run "drush cron-run all --cli --check-rule". That will launch the jobs scheduled to run.
6.) If that works, add the "* * * * * drush cron-run all --cli --check-rule" to your crontab somewhere.
Be aware, that the default rule for Ultimate Cron is */10+@ * * * *, which means every 10th minute, but where each job is skewed one minute compared to the last. This to avoid ALL cron hooks running simultaneously, but instead spreads them out in order to even the load. On the Ultimate Cron job listing page, you can see the actual parsed rule when hovering on the rule. So when running the command in step 5, it might only launch a couple of jobs. Which is then by design.
Regarding the "cron bundle", this is one of the main reason I began on Ultimate Cron (Elysia Cron didn't work the way I wanted to, nor was it in the roadmap AFAICT). We daily had to remove the cron semaphore due to memory exhaust. Also we need to control the rules of the jobs individually. Elysia Cron could do that as well, but did not support true parallel execution at the time (don't know if it does that now besides when setting up drush cron runs for each job).
P.S.: Good I have a paranoid habit of copying web form texts to the clipboard before posting. I think drupal.org switched to https-only while I was writing this post... which of course logged me out :-O.
Comment #23
gielfeldt CreditAttribution: gielfeldt commentedHi asb
Did you get this to work?
Comment #24
asb CreditAttribution: asb commentedSadly no. Calling Cron via Drush results in a promising output like this:
But according to
./admin/settings/cron/overview
, most of the Cron jobs remain in the usual "Starting" state.Also I tried a different approach (calling
http://mysite.org/admin/reports/status/run-cron
through my local PC's Crontab), which basically resulted in a hanging Cron daemon locally. So no luck with workarounds so far.What still puzzles me is why 'Background Process' can't identify the "Default service host". I don't know if this is important (the "The default service host to use" in the dropdown list at
./admin/settings/background-process
is correct), but clicking the "Determine default service host" fails.Comment #25
gielfeldt CreditAttribution: gielfeldt commentedHi
I'm out of ideas at this point :-( ... sorry... well, almost ... are running a drupal subdirectory installation? From the looks of this thread it doesn't seem like it, but I'll just ask anyway.
Comment #26
asb CreditAttribution: asb commentedYou mean multiple sites through one codebase? No, I have one codebase per Drupal site.
I don't intend to bug you with this, but I still don't understand if this "Determine default service host" has any relevance. If it has, I don't get why 'Background Process' seems to be unable to parse the definition given in settings.php.
Maybe the problem is what 'Background Process' considers a valid host? Technically, an URL like https://drupal.org doesn't point to a host (a proper hostnames would be www.drupal.org, mail.drupal.org or en.drupal.org). In fact, Im using on most of my sites these non-strict abbreviated hostnames like http://drupal.org. Could this be a problem?
Comment #27
gielfeldt CreditAttribution: gielfeldt commentedNo, I meant where drupal root is a subdir of document root, resulting in urls like /mydrupalinstallation/node/add/article
I think this still falls back to the requests issued by Background Process results in a 404. I have no explanation for this.
Not sure what you mean by proper hostname? drupal.org is, to my knowledge, no less "proper" than www.drupal.org.
Comment #28
asb CreditAttribution: asb commentedYes and no. Technically, IP addresses on the Internet are resolved through the Domain Name System (DNS); in the strict sense, drupal.org is a domain name, consisting of the second-level domain (drupal) and the top-level domain (org). www.drupal.org is a proper hostname or leaf domain, drupal.org is strictly speaking a hack of the DNS records, where an A resource record directly points to a domain, not to a leaf domain:
This works, as far as I know, only for HTTP/1.1 and above, because the resolution of one IP adress to multiple hostnames becomes ambiguous. HTTP can distinguish hostnames through the HTTP header, which allows Virtual hosting (= hosting multiple domain names on a single server). Before HTTP/1.1, Virtual hosting required multiple IP addresses per host (= IP-based virtual hosting), or running the webservers on different ports (= port-based virtual hosting, e.g. www.drupal.org:80 and www.drupal.org:8080). Name-based virtual hosting causes difficulties with SSL/TLS, because the SSL/TLS handshake takes place before the expected hostname is sent to the server.
So running a website without a leaf domain usually works in modern web browsers, because they can (and need to) read the HTTP host header, but other IP-based services might fail with this setup. The question is, on which network level (respectively with which protocol) 'Background Process' tries to determine the hostname and if - on this level - it has the means to get another response than the _real_ hostname of the server on which the websites are running. In my case, the hostname would be somenumber.myhostingcompany.net, and thats probably the (nonexisting) vhost where the "bgp-start" requests end up, if my suspicion is correct.
Edit: If I add the following statement to apache2.conf (according to http://wiki.apache.org/httpd/DebianDeb0rkification):
…I get this:
The part after the POST record are the HTTP status code (here: 404) and the size of response in bytes (here: 539, 544, 542). So, page not found on somenumber.myhostingcompany.net; still doesn't prove anything :(
Comment #29
gielfeldt CreditAttribution: gielfeldt commentedAccording to your apache logs, the background process request is routed to the default vhost, for whatever reason.
Snippet from the log you posted:
Does the "..." equal the proper vhost? E.g. 11.22.33.44 considering #10
Comment #30
asb CreditAttribution: asb commentedSorry, I'm not sure I understand the question. In Apache's configuration of the vhosts, IP addresses are used. E.g.:
The access log of the default vhost (or whatever "other_vhosts_access.log" logs in Debian) does neither log the IP address defined in "NameVirtualHost" or "VirtualHost" (11.22.33.44), nor in "ServerName" (mysitesdomainname.tld). It logs the default name of the server that is given by the ISP. This name resolves to 11.22.33.44 (multihomed server), but it's not using mysitesdomainname.tld. That's wht I meant in #28 ("Name-based virtual hosting causes difficulties…").
Comment #31
gielfeldt CreditAttribution: gielfeldt commentedHmm. What happened to this issue? Is it still ongoing? I kind of forgot to reply it seems ...
Comment #32
asb CreditAttribution: asb commentedSure, cron is still not executed on most sites. However, we might close the issue as "won't fix" if none of us has any idea how to resolve it.