Qihoo360 / phptrace

A tracing and troubleshooting tool for PHP scripts.
Apache License 2.0
1.68k stars 390 forks source link

No such file or directory(2) #74

Open Gasol opened 7 years ago

Gasol commented 7 years ago

Hi, I'm ports maintainer of pecl-trace 1, I has been updated phptrace to 1.0.0 and encounter this problem.

Run commands described in README as following show error message like ERROR: Invalid process id "54000" "No such file or directory(2)" But it's ok with phptrace -p all

php -r 'for ($i = 0; $i < 10; $i++) usleep(10000);' &
phptrace -p $!

OS

$ uname -a
FreeBSD beastie 10.3-RELEASE-p11 FreeBSD 10.3-RELEASE-p11 #0: Mon Oct 24 18:49:24 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

PHP

$ php -v
PHP 5.6.30 (cli) (built: Jan 21 2017 01:16:05)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

$ php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
filter
hash
imagick
intl
jq
json
JsonNet
libxml
mbstring
mecab
mhash
mysql
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
sockets
SPL
standard
tokenizer
trace
uuid
vld
xdebug
xml
zlib

[Zend Modules]
Xdebug
monque commented 7 years ago

Try it on the lastest FreeBSD, works as expected.

Uname

$uname -a
FreeBSD freebsd.shiva.arena.mo47.com 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

Screenshot screenshot

So, could you re-produce it? using these snippets below.

  1. extend whole cost time

    php -r 'for ($i = 0; $i < 20; $i++) usleep(50000);' &
    phptrace -p $!
  2. Specified pid

    php -r 'for ($i = 0; $i < 100000; $i++) { usleep(50000); echo getmypid()."\n"; }'
    # PID will be displayed by PHP, and phptrace -p $pid