Jump to content
Froxlor Forum
  • 0

"froxlor_master_cronjob.php --tasks" throws some PHP Warnings


Go to solution Solved by d00p,

Question

Hi there,
I'm looking for a hint on how-to debug the following output from "/usr/bin/php -q /var/www/html/froxlor/scripts/froxlor_master_cronjob.php --tasks":

PHP Warning:  dns_get_record(): A temporary server error occurred. in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 226
PHP Warning:  dns_get_record(): A temporary server error occurred. in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 228
PHP Warning:  array_merge(): Expected parameter 1 to be an array, bool given in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 229
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 234
PHP Warning:  dns_get_record(): A temporary server error occurred. in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 226
PHP Warning:  dns_get_record(): A temporary server error occurred. in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 228
PHP Warning:  array_merge(): Expected parameter 1 to be an array, bool given in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 229
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 234

It probably has something to do in context with: "gethostbynamel6" function in there. 

We're not actively/productively using IPV6 (yet). The only thing we have (so far) configured it is in the menu item "IPs and Ports" for some tests in the past. But there should be no BIND-zones with IPV6.
The occurence of this issue is new. It came up after the major update from 0.9x to 0.10.x

Best regards,
Sebastian

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • Solution

Ah okay, does your server possibly not have an ipv6 address and/or cannot connect to ipv6 networks? That could be the origin of the error message, because first we check for ipv6 record (AAAA) and then for ipv4 (A) - and then merge the two results. So if the first fails, it's not an array (should be "false" and I guess array_merge tries to typecast so it's null) and the merge fails.

Can you try the following adjustments to /var/www/html/froxlor/lib/Froxlor/PhpHelper.php:

diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php
index 90b30478..f9fbab55 100644
--- a/lib/Froxlor/PhpHelper.php
+++ b/lib/Froxlor/PhpHelper.php
@@ -223,9 +223,17 @@ class PhpHelper
         */
        public static function gethostbynamel6($host, $try_a = true)
        {
-               $dns6 = dns_get_record($host, DNS_AAAA);
+               $dns6 = @dns_get_record($host, DNS_AAAA);
+               if (!is_array($dns6)) {
+                       // no record or failed to check
+                       $dns6 = [];
+               }
                if ($try_a == true) {
-                       $dns4 = dns_get_record($host, DNS_A);
+                       $dns4 = @dns_get_record($host, DNS_A);
+                       if (!is_array($dns4)) {
+                               // no record or failed to check
+                               $dns4 = [];
+                       }
                        $dns = array_merge($dns4, $dns6);
                } else {
                        $dns = $dns6;

 

Link to post
Share on other sites
  • 0

are you sure the server can resolve domain names correctly?

22 minutes ago, krajenski said:

The occurence of this issue is new. It came up after the major update from 0.9x to 0.10.x

well, there were quite a few changes between them...so...this could be a lot of things

Link to post
Share on other sites
  • 0

Hi!

Yes, name resolution in general is fine on this machine.

After looking at some articles like this:
https://bugs.php.net/bug.php?id=73149
https://stackoverflow.com/questions/36280957/dns-get-record-a-temporary-server-error-occurred
https://dustri.org/b/a-short-tale-on-phps-dns_get_record.html

...I included a 'var_dump(' ... in the lines that were mentioned in the error message(s). (226 + 228 + 229) of .../froxlor/lib/Froxlor/PhpHelper.php
and did a:
# /usr/bin/php -q /var/www/html/froxlor/scripts/froxlor_master_cronjob.php --run-task 4 --force
 

PHP Warning:  array_merge(): Expected parameter 1 to be an array, null given in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 229
NULL
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 234
[warning] Skipping Let's Encrypt generation for some-customer-domain.de due to no system known IP address via DNS check
array(0) {
}
array(1) {
  [0]=>
  array(5) {
    ["host"]=>
    string(22) "www.some-customer-domain.de"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(10799)
    ["type"]=>
    string(1) "A"
    ["ip"]=>
    string(14) "109.237.140.10"
  }
}
PHP Warning:  array_merge(): Expected parameter 1 to be an array, null given in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 229
NULL
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 234
[warning] Skipping Let's Encrypt generation for www.some-domain.de due to no system known IP address via DNS check
array(0) {
}
array(1) {
  [0]=>
  array(5) {
    ["host"]=>
    string(13) "some-domain.de"
    ["class"]=>
    string(2) "IN"
    ["ttl"]=>
    int(10493)
    ["type"]=>
    string(1) "A"
    ["ip"]=>
    string(14) "109.237.140.10"
  }
}
PHP Warning:  array_merge(): Expected parameter 1 to be an array, null given in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 229
NULL
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/froxlor/lib/Froxlor/PhpHelper.php on line 234
[warning] Skipping Let's Encrypt generation for some-domain.de due to no system known IP address via DNS check
array(0) {
}
(...and so on...)

I'm not entirely sure how to intepret it.

PS: If I run this multiple times and 'diff' the output file, the result is identical. It fails for like ~25 entries, of the many hundreds in our system.
Anyway, I can't see a production or productive impact of this at the moment.

Greets,
Sebastian
 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...