• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx

  • We are developing a new feature in Plesk that will help you promote your websites or business on social media. We want to conduct a one-hour online UX test to present the prototype and collect feedback. If you are interested in the feature, please book a meeting via this link.
    Thank you in advance!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

SIGTERM causing API to crash(?)

M

marcovoort

Guest
Hi,

We're facing a problem with the PLESK RPC API. We try to register a user, and append a domain to the user. However, the 'add domain'-call does not work properly.

Recently, we upgraded from PLESK9 to 10, after which our API-calls stopped working. After upgrading the PLESK API yesterday to the most recent version, it still did not work properly. While we first created a 'client' and a 'domain', we now have to create a 'customer', then a 'webspace', and after that a 'site', apparently. We have now adjusted this, but it still won't work.

Relevant part of the process (written in php):
- We POST a request to add a customer
- PLESK creates the customer
- We get back a success-message

- We POST a request to add a webspace for the customer
- PLESK creates the webspace
- We don't get back ANY result, php stops executing

We use the php-module CURL to send the requests. The part of php where we send our requests:
Code:
insertLog('curl_exec1');
//Execute the request.
$result = curl_exec($ch);
insertLog('curl_exec2');
We do see curl_exec1, but not curl_exec2, from which we conclude curl_exec() lets the php-script stop. But, not always: the 'add user' works perfectly, only the 'add webspace' does not work. (Before upgrading the API, it was the 'add domain' causing the execution stop with exactly the same symptoms.)

We do not get an error-message from php, however we do have a log from our PLESK server:
> POST /enterprise/control/agent.php HTTP/1.1
Host: ***.***.***.***:***
Accept: */*
HTTP_AUTH_LOGIN: *****
HTTP_AUTH_PASSWD: *****
HTTP_PRETTY_PRINT: TRUE
Content-Type: text/xml
Content-Length: 679

[Fri Jul 29 14:09:55 2011] [notice] caught SIGTERM, shutting down
[Fri Jul 29 14:09:57 2011] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?
[Fri Jul 29 14:09:57 2011] [warn] RSA server certificate CommonName (CN) `Parallels Panel' does NOT match server name!?

We think the SIGTERM causes the plesk-server to not send anything back to php, but we do not know this for sure.

The request-XML we try to send:
Code:
			<webspace>
				<add>
					<gen_setup>
						<name>marcoplesk18.***.**</name>
						<owner-id>90</owner-id>
						<htype>vrt_hst</htype>
						<ip_address>***.***.***.***</ip_address>
						<status>0</status>
					</gen_setup>
					<hosting>
						<vrt_hst>
							<property>
								<name>ftp_login</name>
								<value>*****</value>
							</property>
							<property>
								<name>ftp_password</name>
								<value>*****</value>
							</property>
							<ip_address>***.***.***.***</ip_address>
						</vrt_hst>
					</hosting>
					
				</add>
			</webspace>

We do not get back any result, however, if the domain already exists, we DO get a result, with a corresponding error message 'Domain marcoplesk18.***.** already exists.' (error #1007). We conclude from this the problem only occurs when we call a 'webspace add', but we do not know why or how to solve it.

We also noticed this topic, but that did not help us much.

Several days of investigating didn't help us solving the problem, we hope someone here can help us out.

Thanks in advance.
Marco


EDIT:
Btw, this is added just before sending the request to the server:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="1.6.3.0">
<!--- request here --->
</packet>
 
Last edited by a moderator:
We did find the solution, however it took a really long while to find out. Turned out that if you do these kind of domain-related requests, the apache-server kills itself and restarts, presumably because it needs to reload the data, as you editted it. In our case, the website which initiated the API call, was also running on plesk, so this script was also killed.
We found a solution by not directly calling the API, but calling the API at another time from another script, not dependent on apache on that server, which turned out to work. Hope it helps.
 
Last edited by a moderator:
Hi Marco,

Thanks for that information, I also found that it was working when running on another server. But the strange thing is that it WAS working before :/
 
Yes indeed, we also thought this was kind of strange, but we did not get an answer here and we got it working finally, so we did not want to pay more attention to the reason why it did not work any more in the old way...
We thought it was a pitty it wasn't backwards compatible, and also a shame that nowhere was stated that this could happen when upgrading.
 
Hi Marco,

Your input was helpful, I started some googling and find some interesting threads.
After a configuration change to a webhosting (create/change/..) Apache is automatically restarted, by default the time to wait after a configuration change to restart is 0 seconds.
This means that while script executing Apache stops and also the script stops working.
But this is the SIGTERM in error logging.

You can Increase the time to wait to restart Apache after a change via Settings -> Server Settings > Apache Restart interval. I now set it to 300 seconds (=5min), by doing this Plesk isn't restarted Apache immediately after adding a new website, but he's doing this after 5 minutes.

Hopefully you can also use this information to get your script back on Plesk :)
 
Back
Top