Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA sync error/warning #3390

Closed
kenshin33 opened this issue Apr 5, 2019 · 11 comments
Closed

HA sync error/warning #3390

kenshin33 opened this issue Apr 5, 2019 · 11 comments
Assignees
Labels
bug Production bug
Milestone

Comments

@kenshin33
Copy link

Since update to (19.1.5 and then 19.1.5_1), notice appears whenever the configuration is synced (either manually or automatically)
it reads [An error occured while atempting XMLRPC sync with username USERNAME and https://ip.of.other.fw/xmlrpc.php parse error not well formed]

To Reproduce

  1. Go to 'System->HA->status '
  2. try to sync config
  3. See Notice apear

Expected behavior
No notice and configuration sync

Relevant log files
running /usr/local/etc/rc.filter_synchronize
yields :

     send >>> 
     Host: 172.16.0.2
     User-Agent: XML_RPC
     Content-Type: text/xml
     Content-Length: 117
     Authorization: Basic XXXXX
     <?xml version="1.0"?>
     <methodCall>
     <methodName>opnsense.firmware_version</methodName>
     <params>
     </params></methodCall>received >>> 
     
     Warning: count(): Parameter must be an array or an object that implements Countable in /usr/local/opnsense/contrib/IXR/IXR_Library.php on line 420
     
     Warning: Cannot modify header information - headers already sent by (output started at /usr/local/opnsense/contrib/IXR/IXR_Library.php:420) in /usr/local/opnsense/contrib/IXR/IXR_Library.php on line 464
     
     Warning: Cannot modify header information - headers already sent by (output started at /usr/local/opnsense/contrib/IXR/IXR_Library.php:420) in /usr/local/opnsense/contrib/IXR/IXR_Library.php on line 465
     
     Warning: Cannot modify header information - headers already sent by (output started at /usr/local/opnsense/contrib/IXR/IXR_Library.php:420) in /usr/local/opnsense/contrib/IXR/IXR_Library.php on line 466
     
     Warning: Cannot modify header information - headers already sent by (output started at /usr/local/opnsense/contrib/IXR/IXR_Library.php:420) in /usr/local/opnsense/contrib/IXR/IXR_Library.php on line 467
     <?xml version="1.0"?>
     <methodResponse>
       <params>
         <param>
           <value>
           <struct>
       <member><name>base</name><value><struct>
       <member><name>version</name><value><string>19.1.4</string></value></member>
     </struct></value></member>
       <member><name>firmware</name><value><struct>
       <member><name>version</name><value><string>19.1.5_1</string></value></member>
     </struct></value></member>
       <member><name>kernel</name><value><struct>
       <member><name>version</name><value><string>19.1.4</string></value></member>
     </struct></value></member>
     </struct>
           </value>
         </param>
       </params>
     </methodResponse>
     error >>> 
     parse error. not well formed

Environment
OPNsense 19.1.15_1 (amd64, OpenSSL).

@kenshin33
Copy link
Author

this seems to fix it !

--- /usr/local/opnsense/contrib/IXR/IXR_Library.php     2019-04-05 17:13:17.690656000 -0400
+++ ./IXR_Library.php   2019-04-05 17:41:22.909773000 -0400
@@ -417,7 +417,7 @@ EOD;
         $method = $this->callbacks[$methodname];
 
         // Perform the callback and send the response
-        if (count($args) == 1) {
+        if ((is_array($args) || $args instanceof Countable) && count($args) == 1) {
             // If only one paramater just send that instead of the whole array
             $args = $args[0];
         }

@AdSchellevis
Copy link
Member

Which options are enabled under System -> High Availability -> Settings?

@kenshin33
Copy link
Author

kenshin33 commented Apr 6, 2019

All except Monit and Intrusion detection.
Plus the following plugins :

  • WOL
  • Zabbix
  • Relayd

(on an other note: The sync goes one way, 1->2. is there a way to make it 2 ways 1<->2? If I configure 2 to sync to 1 and modify something on 2, will it just work, or I will I get a loop 1 -> 2 -> 1 -> 2 ... etc.?)

@AdSchellevis
Copy link
Member

can you try to disable the plugins sync and see if it persists?

(you can't do a two way sync, since the nodes don't know when a specific entry was changed)

@kenshin33
Copy link
Author

tested with change reverted : the notice appears.
unticked all plugins, saved and synced again : the notice does NOT appear.
if I tick any thing and save, the notice appears.

(that was my impression. Thanks for the confirmation)

@chrko
Copy link
Contributor

chrko commented Apr 6, 2019

This error also occurs at my test system. I think this is due to upgrading php from 7.1 to 7.2:
https://www.php.net/manual/en/migration72.incompatible.php#migration72.incompatible.warn-on-non-countable-types

@chrko
Copy link
Contributor

chrko commented Apr 6, 2019

this seems to fix it !

--- /usr/local/opnsense/contrib/IXR/IXR_Library.php     2019-04-05 17:13:17.690656000 -0400
+++ ./IXR_Library.php   2019-04-05 17:41:22.909773000 -0400
@@ -417,7 +417,7 @@ EOD;
         $method = $this->callbacks[$methodname];
 
         // Perform the callback and send the response
-        if (count($args) == 1) {
+        if ((is_array($args) || $args instanceof Countable) && count($args) == 1) {
             // If only one paramater just send that instead of the whole array
             $args = $args[0];
         }

Works perfectly ;)

@AdSchellevis
Copy link
Member

@chrko it looks like you're right, the warning wasn't in 7.1, we have seen some other small glitches as well.

@AdSchellevis AdSchellevis self-assigned this Apr 7, 2019
@AdSchellevis AdSchellevis added the bug Production bug label Apr 7, 2019
@fichtner fichtner added this to the 19.7 milestone Apr 7, 2019
@AdSchellevis
Copy link
Member

@kenshin33 @chrko can you test and confirm 9452022

@kenshin33
Copy link
Author

@AdSchellevis I did and it seemed to work (before creating the issue).
By work I mean : the notice no longer appears and the slave node picks up the changes

@LPJon
Copy link

LPJon commented Apr 9, 2019

--- /usr/local/opnsense/contrib/IXR/IXR_Library.php     2019-04-05 17:13:17.690656000 -0400
+++ ./IXR_Library.php   2019-04-05 17:41:22.909773000 -0400
@@ -417,7 +417,7 @@ EOD;
         $method = $this->callbacks[$methodname];
 
         // Perform the callback and send the response
-        if (count($args) == 1) {
+        if ((is_array($args) || $args instanceof Countable) && count($args) == 1) {
             // If only one paramater just send that instead of the whole array
             $args = $args[0];
         }

@chrko I feel a bit like a noob here but I implemented these changes with no change in result? I'm slightly confused am I supposed to remove the file "IXR_Library.php" and then recreate it with only the above mentioned code in it. Or was that simply make a backup of the original file first? On a side note the code I see does not have "EOD;" just before the "$method = " variable. The earliest that "EOD;" appears before the section mentioned above is on line 407. Would it be too much to ask to have the entire modified file posted here. I've been doing this for years but this isn't matching what I have. My OPNSense version is 19.1.5_1.

UPDATE:
I found this link provided by @AdSchellevis which can be used from the console to pull the patched file to the gateway. FYI-This has to be done on BOTH gateways to work. Just pull the file and then test your sync.

"curl -o /usr/local/opnsense/contrib/IXR/IXR_Library.php https://raw.githubusercontent.com/opnsense/core/945202230726af76582103680fa4c49114670752/contrib/IXR/IXR_Library.php"

INFO - The corrected string should look like this officially as of 22 hours ago and can be edited directly if you wish:
if (is_array($args) && count($args) == 1) {

fichtner pushed a commit that referenced this issue Apr 9, 2019
…ng for an array should be enough here, other types aren't supported. closes #3390

(cherry picked from commit 9452022)
EugenMayer pushed a commit to KontextWork/opnsense_core that referenced this issue Jul 22, 2019
…ng for an array should be enough here, other types aren't supported. closes opnsense#3390
EugenMayer pushed a commit to KontextWork/opnsense_core that referenced this issue Jul 22, 2019
…ng for an array should be enough here, other types aren't supported. closes opnsense#3390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Production bug
Development

No branches or pull requests

5 participants