1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

SIGTERM causing API to crash(?)

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by marcovoort, Jul 29, 2011.

  1. marcovoort

    marcovoort Guest

    0
     
    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:
    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: May 13, 2012
  2. Steve Vos

    Steve Vos New Pleskian

    13
    60%
    Joined:
    Feb 6, 2012
    Messages:
    16
    Likes Received:
    0
    Did you find a solution for this issue? Got exactly the same..
     
  3. marcovoort

    marcovoort Guest

    0
     
    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: May 13, 2012
  4. Steve Vos

    Steve Vos New Pleskian

    13
    60%
    Joined:
    Feb 6, 2012
    Messages:
    16
    Likes Received:
    0
    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 :/
     
  5. marcovoort

    marcovoort Guest

    0
     
    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.
     
  6. Steve Vos

    Steve Vos New Pleskian

    13
    60%
    Joined:
    Feb 6, 2012
    Messages:
    16
    Likes Received:
    0
    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 :)
     
Loading...