At present, there is a process service script that is the interface of the continuous query channel, but the historical problem is that sometimes the process will be stuck when the order volume is large, so please check it this time:

Get the process ID first

Ps - aux | grep QueryABC. PHP sync360 11115 6564 864 0.0 0.0? Ss 14:00 0:00 /bin/sh -c /usr/local/bin/php /xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/QueryABC.php BILL99DF 10-8>> /home sync360 11124 0.0 0.4 361628 17296? S 14:00 0:04 /usr/local/bin/php /xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/QueryABC.php BILL99DF 10-8 sync360 25230 0.0 0.0 63384 872 PTS /0 S+ 15:28 0:00 grep queryabc.phpCopy the code

Strace checks the ongoing status of the process

sudo strace -T -tt -e trace=all -p 11124 [sudo] password for ancongcong: Process 11124 attached-Interrupt to quit 15:33:07.259044 Read (9,Copy the code

Lsof Displays the files used by the process

lsof -p 11124 .... PHP 11124 sync360 mem REG 8,1 23736 3211320 /lib64/libnss_dns-2.5.so PHP 11124 sync360 0r FIFO 0,6 1522728709 pipe PHP REG 8, 1 11124 sync360 1 w / 4088819/1869737 / XXXX XXXX XXXX XXXX/logs/QueryABC log PHP sync360 2 w FIFO 0, 6 1522728710 11124 Pipe PHP 11124 sync360 3w CHR 1,3 982 /dev/null PHP 11124 sync360 4u IPv4 1522728838 TCP 211.151.122.234:46004->10.117.128.47:rtmp-port (CLOSE_WAIT) PHP 11124 sync360 5wW REG 8,1 0 2704363 /xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/lockfile/QueryABC.php.BILL99DF.10-8 php 11124 sync360 6u IPv4 1522728841 TCP 211.151.122.234:51019->10.117.128.46:rtmp-port (CLOSE_WAIT) PHP 11124 sync360 7w REG 8,1 31960384 1869789 / / XXXX XXXX XXXX XXXX/logs/XXXX_info. The PHP sync360 8 w REG 8, 1 11124 20180118 18151722 1869806 /xxxx/xxxx/xxxx/xxxx/logs/XXXX_QRY_info.log.20180118 php 11124 sync360 9u IPv4 1522729884 TCP 211.151.122.234:54976 - > 61.152.114.130: HTTPS (ESTABLISHED)Copy the code

Sudo netstat tunpa | grep TCP 11124 0 0 211.151.122.234:54976 61.152.114.130:443 ESTABLISHED 11124 / PHP TCP 1 0 211.151.122.234:51019 10.117.128.46:3500 TCP 10 211.151.122.234:46004 10.117.128.47:3500 CLOSE_WAIT 11124/phpCopy the code

You can see that you end up with a link set up in HTTPS, waiting to get data, look at the code here

ini_set('default_socket_timeout',30);
$scOptions = array('connection_timeout' => 30);
$clientObj = new SoapClient( $wsdl , $scOptions);
 Copy the code

The current version of PHP is older, but there is a bug that SOAPClient timeout does not take effect in HTTPS connection requests. Finally, the following solution is adopted to solve the problem:

Using curl to complete the request to solve the problem

<? php class SoapClientTimeout extends SoapClient { private $timeout; public function __setTimeout($timeout) { if (! is_int($timeout) && ! is_null($timeout)) { throw new Exception("Invalid timeout value"); } $this->timeout = $timeout; } public function __doRequest($request, $location, $action, $version, $one_way = FALSE) { if (! $this->timeout) { // Call via parent because we require no timeout $response = parent::__doRequest($request, $location, $action, $version, $one_way); } else { // Call via Curl and use the timeout $curl = curl_init($location); curl_setopt($curl, CURLOPT_VERBOSE, FALSE); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_POST, TRUE); curl_setopt($curl, CURLOPT_POSTFIELDS, $request); curl_setopt($curl, CURLOPT_HEADER, FALSE); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout); $response = curl_exec($curl); if (curl_errno($curl)) { throw new Exception(curl_error($curl)); } curl_close($curl); } // Return? if (! $one_way) { return ($response); }}}Copy the code

Related articles

  • Error: pg_config Executable Not found
  • Resolve Session callback expects True /false return value in PHP7
  • Failed to send Linux mail
  • Resolve the /var/spool/clientmqueue/ file overload problem and document how to quickly list the contents of folders with more files under Linux