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

RPC not working (HTTP status 500) #1311

Open
kongsted opened this issue Feb 1, 2025 · 10 comments
Open

RPC not working (HTTP status 500) #1311

kongsted opened this issue Feb 1, 2025 · 10 comments

Comments

@kongsted
Copy link

kongsted commented Feb 1, 2025

Hi,

I'm trying to do a setup with three servers, where I want RPC to work between the servers.
The servers are running Rocky Linux 9.2 with "native" PHP (8.0.30).

I have done the config.php to work with RPC, but despites that, I'm only getting "HTTP/1.1 500 Internal Server Error" returned from the other servers (they're using a copy of the config, to ensure it's working - and the web-interface with MailWatch are also working fine - except RPC - from the other servers).

I'm using MailWatch version 1.2.30.

Any clue how to troubleshoot this issue? :)

Br,
Anders

@Skywalker-11
Copy link
Member

Do you see any error in the webserver log?

@kongsted
Copy link
Author

kongsted commented Feb 1, 2025

I'm "only" seeing the apache-log with the error.

1.2.3.4 - - [01/Feb/2025:22:07:51 +0100] "POST /rpcserver.php HTTP/1.0" 500 - "-" "XML-RPC for PHP 3.0.0.beta"

Or is there somewhere else to check some logs?

@Skywalker-11
Copy link
Member

The log message look like it is from the access log. In most cases (but depending on your specific config) apache has separate log files for logging general requests (the access log) and error messages.

If you use php-fpm these errors might also be logged on those logs.

@kongsted
Copy link
Author

kongsted commented Feb 1, 2025

Thank you for learning me something new - wasn't aware of those logs. :)

Error-out in php-fpm:
[01-Feb-2025 22:54:53 Europe/Copenhagen] PHP Fatal error: Uncaught Error: Call to undefined function each() in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc:2701 Stack trace: #0 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1854): xmlrpcval->serialize() #1 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpcs.inc(561): xmlrpcresp->serialize() #2 /opt/mailwatch/mailscanner/rpcserver.php(333): xmlrpc_server->service() #3 {main} thrown in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc on line 2701

@Skywalker-11
Copy link
Member

The error should be fixed by 4b58985

Can you try the current code in the 1.2 branch and see if that fixes your issues?

@kongsted
Copy link
Author

kongsted commented Feb 2, 2025

I have tried with the latest code (downloaded the zip-file of the repo - not only the few changed files in the commit).

It fails, and very little are showed on the webpage (only the first elements).

Error in php-fpm log:

[02-Feb-2025 09:51:51 Europe/Copenhagen] PHP Warning:  Undefined array key "%rules-dir%" in /opt/mailwatch/mailscanner/functions.php on line 1916
[02-Feb-2025 09:51:51 Europe/Copenhagen] PHP Warning:  Undefined array key "%rules-dir%" in /opt/mailwatch/mailscanner/functions.php on line 1916
[02-Feb-2025 09:51:51 Europe/Copenhagen] PHP Fatal error:  Uncaught Error: Call to undefined function each() in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc:2096
Stack trace:
#0 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(2239): xmlrpcmsg->parseResponseHeaders()
#1 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1520): xmlrpcmsg->parseResponse()
#2 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1300): xmlrpc_client->sendPayloadCURL()
#3 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1094): xmlrpc_client->sendPayloadHTTPS()
#4 /opt/mailwatch/mailscanner/functions.php(4176): xmlrpc_client->send()
#5 /opt/mailwatch/mailscanner/functions.php(588): xmlrpc_wrapper()
#6 /opt/mailwatch/mailscanner/functions.php(410): printMTAQueue()
#7 /opt/mailwatch/mailscanner/status.php(32): html_start()
#8 {main}
  thrown in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc on line 2096

(I'm not sure why the warning - the variable are defined with the value '/etc/MailScanner/rules' when checking /msconfig.php)

@endelwar
Copy link
Member

endelwar commented Feb 3, 2025

Looks like I missed an each last summer, my bad!

@kongsted
Copy link
Author

kongsted commented Feb 3, 2025

No problem. :)

But new error occours. :)

[03-Feb-2025 18:22:17 Europe/Copenhagen] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc:2329
Stack trace:
#0 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1520): xmlrpcmsg->parseResponse()
#1 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1300): xmlrpc_client->sendPayloadCURL()
#2 /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc(1094): xmlrpc_client->sendPayloadHTTPS()
#3 /opt/mailwatch/mailscanner/functions.php(4212): xmlrpc_client->send()
#4 /opt/mailwatch/mailscanner/functions.php(591): xmlrpc_wrapper()
#5 /opt/mailwatch/mailscanner/functions.php(413): printMTAQueue()
#6 /opt/mailwatch/mailscanner/status.php(32): html_start()
#7 {main}
  thrown in /opt/mailwatch/mailscanner/lib/xmlrpc/xmlrpc.inc on line 2329

@kongsted
Copy link
Author

kongsted commented Feb 6, 2025

When I'm debugging, it seems like getting some kind of the expected response from remote server.

---GOT---
HTTP/1.1 200 OK
Date: Thu, 06 Feb 2025 21:11:58 GMT
Server: Apache/2.4.62 (Rocky Linux) OpenSSL/3.2.2
X-Powered-By: PHP/8.0.30
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Set-Cookie: MW_LANG=en; path=/
Set-Cookie: PHPSESSID=<removed>; path=/; HttpOnly
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value><struct>
<member><name>inq</name>
<value><string>0</string></value>
</member>
<member><name>outq</name>
<value><string>0</string></value>
</member>
</struct></value>
</param>
</params>
</methodResponse>
---END---

HEADER: date: Thu, 06 Feb 2025 21:11:58 GMT
HEADER: server: Apache/2.4.62 (Rocky Linux) OpenSSL/3.2.2
HEADER: x-powered-by: PHP/8.0.30
HEADER: x-xss-protection: 1; mode=block
HEADER: x-frame-options: SAMEORIGIN
HEADER: x-content-type-options: nosniff
HEADER: expires: Thu, 19 Nov 1981 08:52:00 GMT
HEADER: cache-control: no-store, no-cache, must-revalidate
HEADER: pragma: no-cache
HEADER: content-encoding: gzip
HEADER: vary: Accept-Encoding
HEADER: set-cookie: MW_LANG=en; path=/, PHPSESSID=<removed>; path=/; HttpOnly
HEADER: transfer-encoding: chunked
HEADER: content-type: text/xml; charset=UTF-8
COOKIE: MW_LANG=en
COOKIE: PHPSESSID=<removed>

The response above is identical if there is one or two servers listed in "RPC_REMOTE_SERVER" (there is 3 servers in total in the setup).

@kongsted
Copy link
Author

Any idea to something I could test, to troubleshoot this issue? :)
//Anders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants