Rasmus Lerdorf | 19 Jul 2012 20:14

[PHP-DEV] How to track down an APC bug

The goal of this message is to encourage and motivate a few people to
give me a hand with tracking down APC bugs. There are still a few
outstanding bugs that is slowing PHP 5.4 adoption and it would be really
nice to plow through these instead of wasting cycles on some of the
other discussions going on here.

The example bug I will use is one I just fixed. Bug http://php.net/62398
which was that with apc.stat=0 the second request (eg. the cached
request) to a certain script would have include filenames replaced with
an empty string.

Clue #1 here is that we are dealing with string literals and those
obviously changed a lot in 5.4.

Clue #2 I got lucky with. I was able to reproduce it locally which makes
everything much simpler because then Valgrind can do most of the
thinking for us.

So, knowing it has to do with string literals and taking my reproduce
case, I first eliminated all non-php code by using the built-in web
server in 5.4. I have a little memcheck shell script that runs Valgrind
with my preferred options. It looks like this:

#!/bin/bash
USE_ZEND_ALLOC=0 valgrind --tool=memcheck
--suppressions=/home/rasmus/.suppressions --leak-check=yes
--track-origins=yes --num-callers
=30 --show-reachable=yes "$ <at> "

And my .suppressions file can be found here:
(Continue reading)

Andrew Faulds | 19 Jul 2012 23:40
Gravatar

Re: [PHP-DEV] How to track down an APC bug

Forgive my ignorance, what is APC?
On Jul 19, 2012 7:15 PM, "Rasmus Lerdorf" <rasmus <at> lerdorf.com> wrote:

> The goal of this message is to encourage and motivate a few people to
> give me a hand with tracking down APC bugs. There are still a few
> outstanding bugs that is slowing PHP 5.4 adoption and it would be really
> nice to plow through these instead of wasting cycles on some of the
> other discussions going on here.
>
> The example bug I will use is one I just fixed. Bug http://php.net/62398
> which was that with apc.stat=0 the second request (eg. the cached
> request) to a certain script would have include filenames replaced with
> an empty string.
>
> Clue #1 here is that we are dealing with string literals and those
> obviously changed a lot in 5.4.
>
> Clue #2 I got lucky with. I was able to reproduce it locally which makes
> everything much simpler because then Valgrind can do most of the
> thinking for us.
>
> So, knowing it has to do with string literals and taking my reproduce
> case, I first eliminated all non-php code by using the built-in web
> server in 5.4. I have a little memcheck shell script that runs Valgrind
> with my preferred options. It looks like this:
>
> #!/bin/bash
> USE_ZEND_ALLOC=0 valgrind --tool=memcheck
> --suppressions=/home/rasmus/.suppressions --leak-check=yes
> --track-origins=yes --num-callers
(Continue reading)

Kalle Sommer Nielsen | 19 Jul 2012 23:44
Picon
Gravatar

Re: [PHP-DEV] How to track down an APC bug

2012/7/19 Andrew Faulds <ajfweb <at> googlemail.com>:
> Forgive my ignorance, what is APC?

Alternative PHP Cache

http://pecl.php.net/apc
http://php.net/apc

-- 
regards,

Kalle Sommer Nielsen
kalle <at> php.net

--

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

jpauli | 20 Jul 2012 10:41
Picon
Gravatar

Re: [PHP-DEV] How to track down an APC bug

On Thu, Jul 19, 2012 at 8:14 PM, Rasmus Lerdorf <rasmus <at> lerdorf.com> wrote:
> The goal of this message is to encourage and motivate a few people to
> give me a hand with tracking down APC bugs. There are still a few
> outstanding bugs that is slowing PHP 5.4 adoption and it would be really
> nice to plow through these instead of wasting cycles on some of the
> other discussions going on here.

Heh Rasmus, that's an interesting step you take.
Thanks for explaining/sharing us your strategy, that in fact may help
ppl with APC bug fixing, as APC is all but an easy extension, and
requires deep Zend VM understanding.

Julien.P

--

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Adam Jon Richardson | 20 Jul 2012 18:49
Picon

Re: [PHP-DEV] How to track down an APC bug

On Thu, Jul 19, 2012 at 2:14 PM, Rasmus Lerdorf <rasmus <at> lerdorf.com> wrote:
> The goal of this message is to encourage and motivate a few people to
> give me a hand with tracking down APC bugs. There are still a few
> outstanding bugs that is slowing PHP 5.4 adoption and it would be really
> nice to plow through these instead of wasting cycles on some of the
> other discussions going on here.

This type of content is exactly why I'm signed up on the list. I'll
not make any promises about APC work specifically (it seems a bit more
complex than the other extensions), but this information generalizes
to bug hunting in other extensions, too.

Thank you very much!

Adam

--

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Gmane