PHP Curl Connection not released, Strace result: Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000) = 0 (Tim

Source: Internet
Author: User
Tags curl

First, the phenomenon

1. See if a process exists

Ps-ef | Grep-v ' grep ' |grep-e ' Shell/cron/bonus/cash '

www 2624 1 0 Oct24? 00:00:35/usr/local/bin/php/data1/www/htdocs/hb.e.weibo.com/v2/www/htdocs/index.php--uri=shell/cron/bonus/cash- -get=proc_num=1&proc_total=1--post=


2. View process creation time

Ps-p 2624-o Lstart

Started

Sat OCT 24 22:20:03 2015


3. View system calls to the process

Strace-p 2624

Process 2624 Attached-interrupt to quit

Restart_syscall (... resuming interrupted call ...>) = 0

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 0) = 0 (Timeout)

Poll ([{fd=5, events=pollin| pollpri| pollrdnorm| Pollrdband}], 1, 1000 = 0 (Timeout)


4. View fd=5 open files

Lsof-d 5 | grep 2624

PHP 2624 www 5u IPv4 3876970637 0t0 TCP 10.74.14.199:45473->host-31.alipay.com:https (established)


Second, reproduce

1. Listening for 107.170.249.52 1234 ports
NC-L 1234

2. Visit 107.170.249.52:1234
Curl http://107.170.249.52:1234

3.107.170.249.52 received the request

4.strace The Curl Process

5. Consistent with the phenomenon described above


Third, solve

Law 1:

Set timeout when Php curl call

Law 2:


Wen/k1ic (author of Jane book)
Original link: http://www.jianshu.com/p/8a247cae629a
Copyright belongs to the author, reproduced please contact the author to obtain authorization, and labeled "Jane book author."

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.