WHMCS fails to provision with Virtualmin

Team,

When attempting to provision a virtual server using WHMCS it reaches a timeout. I have enabled rpc calls for the root and my whmcs user account but it isn't working. I have also made sure the hostname and ip address has the virtualmin port and if I click login it will log me into virtualmin from WHMCS. Any thoughts? This is a fresh install with the latest Virtualmin and Webmin packages.

Status: 
Active

Comments

Assigned: ยป Unassigned

Howdy -- hmm, is there any chance you could share the exact error that you're receiving?

Also, is there a firewall running on your server? If so, you may want to temporarily disable it, just to ensure that it's not interfering.

Is whmcs running on the same server as virtualmin? if so the firewall isn't the issue. If you have a separate machine for whmcs then you need to see what ports are needed..then you can create a rule that allows that traffic from the whmcs box to your virt box at that port is allowed.

Separate boxes. Firewall allows 10000 on the Virtualmin host. Might not be open on the WHMCS host. Here's the error: Curl Error: 28 - Connection timed out after 60001 milliseconds

yeppers. make sure the firewalls on both sides allow traffic from the other machine.

I'm checking with the other host about the port now.

I'd definitely recommend disabling the firewall. The RPC uses ports other than 10000, and it will rule some other things out as well.

However, if it's using RPC you'd want to open ports 10001 - 10010.

At the time only 10000 can be opened. If the need arises then I can apply pressure. However I don't plan to be at this host much longer.

Disabling the firewall is not a fix.

you need a host that allows you to control your firewalls. I am with one that allows you to setup your own firewalls at the machines....checkout reliablehostingservices.net. Tell them William Warren sent you. You can then setup firewalls on each machine and have full control over the traffic.

Firewall hasn't been disabled. Had host open 10000 on their side. It's where whmcs is and where I put my cPanel clients.

Hello Guys,

I am facing the same issue. Both installations are on the same VPS, clean installation. I get no errors in the logs.

In WHMCS when I click Create (to create a new service), the Working... symbol keeps going and never ends. The Virtual Server is actually created successfully on Virtualmin, but WHMCS does not know thus not deploying the information (sending e-mails) nor populating the client account with the new product. I hope someone can give some clue, is very annoying issue.

Best regards to all.

Have you raised this issue with WHMCS?

Yeah I did, no reply yet. If I link an other server (same Debian/Virtualmin environment) it works with no problem, I tried last night.

I compare things in the hope to find the difference but nothing is different from the settings point of view, made everything rigorously identical (plan and template). I have enabled PHP Logs but nothing in the logs. It is very annoying. If someone has some clue please help. I will update you if I receive any answer from WHMCS support.

To give more information; If the option Accept and Create the server immediately is selected, it will drop an Internal Server Error 500. And no logs at all are recorded.

The 500 error should definitely produce an error log somewhere. You may want to review the logs in /var/log/virtualmin and /var/log/apache/error_log to see which Apache logs are generating an error at the time that happens.

However, we'd definitely recommend reaching out to the WHMCS folks, as they'd better understand what's going on there.

We're happy to help them out in any way we can though.

Hi andreycheck,

Incredibly there is no error generated at all. I got crazy over this. From WHMCS support I received a reply to check permissions and owners, did everything. The fact that WHMCS works if connected to an other Virtualmin server means that there might be no issue with the WHMCS installation. Because I could not solve this, I am reinstalling the VPS hopping that I did some mistake somewhere (which I doubt) previously. I will update you just for information if this will solve the issue. Regards, Endri.

Hi everybody,

I reinstalled everything and restored the WHMCS database. Now it works fine. But I am concerned about this issue, I didn't find what was causing it. If it happens again it would be a mess on a populated system...

eugenevdm.host's picture
Submitted by eugenevdm.host on Tue, 12/18/2018 - 07:39

In WHMCS when I click Create (to create a new service), the Working... symbol keeps going and never ends. > The Virtual Server is actually created successfully on Virtualmin, but WHMCS does not know thus not deploying the information (sending e-mails) nor populating the client account with the new product.

I have a similar issue CentOS 7 VPS, latest versions of everything.

When I do create package command from WHMCS, I also get the Working...symbol going on forever and never ends.

  1. As with yourself the Virtual Server is created successfully on Virtualmin.

  2. New Hosting Account Information is not sent, same as you.

  3. The client's account is however populated with the new product. So it's "working".

However, overuse is not calculated properly. It appears Overuse is calculated on the Default Plan which has unlimited traffic, as opposed to my "Basic" plan which has a 1 GB limit.

I want to know if it's possible to debug the Remote API / CGI interface? Is there a log file?

eugenevdm.host's picture
Submitted by eugenevdm.host on Sat, 03/30/2019 - 08:25

Just isolated this problem. Installed a fresh WHMCS. Connect from fresh WHMCS to problematic Virtualmin server, same hung issue. Connect to Virtualmin on new server, working 100%. So I conclude Virtualmin on server A is broken. I highly suspect SSL or something. The annoying this is the remote API does not log much detail at all.

It's like it's stuck for 60 seconds, but yet it does complete the work. Looked at remote.cgi but I don't really want to troubleshoot that deep.

A real lifesaver here would be extremely verbose logging for the remote API but I can't find any setting.

eugenevdm.host's picture
Submitted by eugenevdm.host on Sun, 03/31/2019 - 02:33

After much testing I have concluded this happens because Virtualmin is very slow when returning results on a small server for list-domains and multiline. I have documented my findings on the WHMCS Feature Requests website https://requests.whmcs.com/topic/virtualmin-provisioning-module-curl-req... but it would be useful if someone from Virtualmin can tell us why doing the remote CGI commands list-domains and multiline often takes more than a minute to complete.

How long does it take if you run virtualmin list-domains --multiline from the command line?

eugenevdm.host's picture
Submitted by eugenevdm.host on Tue, 04/02/2019 - 00:40

Hi @JamieCameron,

Thanks for replying. If I run a test script, such as below, then it completes in anywhere from 30 seconds to about 2 minutes. FYI the server spec is: 4 GB RAM, 5 x not busy websites 20 x email addresses, of which some are very busy.

`<?php $result = shell_exec("wget -O - --quiet --http-user=root --http-passwd=password 'https://server.host.com:10000/virtual-server/remote.cgi?program=list-dom...'");

echo $result; `

However, when it runs as part of the WHMCS Cron, I believe it takes much longer. From observation the daily CRON on a server causes quite a lot of load. For example, emails might be sent for overdue invoices, domain renewals, etc. On the server itself, the CRON only finishes 1% of the time in under 60 seconds. We also removed CLAM from a couple of busy mailboxes reducing the time to completion quite a lot.

When I examined the issue with top and the command line I concluded it can't be a server timeout. On the command line, even if it takes very long, the server never times out. It would wait up to 3 minutes to complete. In top I can see list-domains.cgi happily running in the background. But I believe WHMCS is using CURL with a hard-coded timeout because the message in the WHMCS module log is:

"Curl Error: 28 - Operation timed out after 60000 milliseconds with 59185 bytes received"

I notified WHMCS about another issue where domain usage data is out of sync with the Virtualmin module, and they informed me the Virtualmin module is "encrypted" so I think there might be some kind of deadlock. You know the kind where WHMCS says it's the module provider's problem, and the module provider says it's WHMCS's problem.

Ahaaaaa finally I place where thus is being discussed.

I run Blesta instead of whmcs, and you know what...recently I started getting this exact same error with Blesta!

It sends the request, the services are provisioned on virtualmin, however, Blesta times out and does not record the services are provisioned on only new accounts where thus error occurs. On all existing accounts prior to thus error, things seem to work fine.

Blesta developers reckon it's something to do with webserver restarting during the procedure and that it should not happen if their software is on a separate machine. Perhaps this is also relevant here?

Mine also won't even work if run from an automated cron instead of instant manual activation.

What confuses me, mine was working for about 1 month and all of a sudden, this happens to me too.

Logs don't appear to show anything.

eugenevdm.host's picture
Submitted by eugenevdm.host on Tue, 04/23/2019 - 13:21

Hi @adamjedgar,

I have a ton of experience troubleshooting this problem and will try and help you here or we can take this offline if you wish.

Here are a couple of things you can use in the isolation process:

  • First of all, yes possibly making the billing system separate from what is being provisioned will help and should be considered. It's a better practice as well. But understand there is a difference between "restart Apache" and "reload Apache". In theory when you add a new domain you are reloading which is pretty quick and shouldn't be disruptive, versus restart which will kill all running websites in it's tracks and restarts them. I know long ago Plesk and WHMCS had issues if you provisioned on the same server so isolating this same server situation will be a good idea.

  • Second of all, do consider performance. This is really easy if you have SSH access. Just run 'top' and provision. The full command to test is something like:

`<?php $result = shell_exec("wget -O - --quiet --http-user=root --http-passwd=password 'https://server.domain.com:10000/virtual-server/remote.cgi?program=list-d...'");

echo $result;`

Note in the above multiline which is the extended listing command that takes longer than without it. From my tests even on a small 2vCPU server with not even 10 sites this command can take anywhere from 30 seconds to 2 minutes. That is a very long time and lots of billing systems will run out of steam. If your billing system is using WGET you might even run into a 1 minute timeout which seems to be a default on some systems and has to be changed in the code, not on the server. WHMCS was so kind to send me a new Virtualmin module with a three minute timeout which took care of that part of my problem.

Mine also won't even work if run from an automated cron instead of instant manual activation.

What is the error message? Take a timer and see if it's a minute or an exact interval every time. If it's an exact interval, say 30 seconds, or 60 seconds, or whatever, it's most likely a timeout.

What confuses me, mine was working for about 1 month and all of a sudden, this happens to me too.

Perhaps your server got busier in the last month? Perhaps many more mailboxes? Spam and virus filtering can bog your server down badly but is easily identifiable with top.

Logs don't appear to show anything.

Yep. That also threw me for hours / days. I think the fact of the matter is that on the server side "nothing is wrong". It's just slow. So the billing system times out. Only if something actually goes wrong on the server side an error will be reported. For now, it's just a slowwww operation.

Top is your friend, my friend.

warm regards, Eugene

https://vander.host

Hi Eugene, I have begun moving across to WHMCS because of this error...my feeling is that having a much larger user base will see a resolution with WHMCS in preference to Blesta.

Having said that, there are no error logs...that is the problem. I actually gave the Blesta developers full access to my Virtualmin system and they are convinced the problem is coming from Webmin itself.

Essentially what i believe they are saying is this...Blesta is using the Webmin API in order to provision services. The process is quite fast usually only takes about 12 -15 seconds to complete if I am just creating an empty Virtual server (so timeout shouldnt be the issue...I increased that in php and it made no difference anyway)

The issue as far as i can tell is that Blesta sends the request via Webmin API, Webmin correctly provisions services (ie a virtual server), however at this point webmin is not then sending that information back to Blesta. This is where the problem lies and according to Blesta devs, it is because webmin is reloading at the point of povisioning of services thus closing off communication to Blesta until it reloads...of course this loss of connection ends the transaction and Blesta does not update.

Blesta devs are convinced that if one is running on a separate system, this would not be a problem...I cannot remember why exactly. The question i have is, initially this was working for about 3 weeks and then all of a sudden it stopped working???