PHP is segfaulting, what to do next?
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
PHP is segfaulting, what to do next?
I am attempting to run a unit test suite on an external server, but PHP keeps segfaulting. I cannot reproduce it on my computer. The location of the segfault is consistently at the same spot, but makes no sense as to why. What to do now?
Let me guess, it's part of a class that is causing the seg fault. and all you get is "An error has occurred. Please report this to support @ php.net" or something like that? or is this something completely different?
If it's what I just said, and it's php 4, I've run into a similar problem, but found no solution. The class would work fine on our corporate servers but when I pulled it locally it would bomb. Worse yet, it would only happen in gentoo linux, windows boxes would run fine. heh..
If it's what I just said, and it's php 4, I've run into a similar problem, but found no solution. The class would work fine on our corporate servers but when I pulled it locally it would bomb. Worse yet, it would only happen in gentoo linux, windows boxes would run fine. heh..
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
That's the kicker: it segfaults in the initialization code, during a for() {} loop that is outputting <input> fields!run each test separately to narrow it down...?
Nope. It just stops executing. When I call via command line it actually says "Segfault, see core dump" via the error stream, but that's it.Let me guess, it's part of a class that is causing the seg fault. and all you get is "An error has occurred. Please report this to support @ php.net" or something like that? or is this something completely different?
Here's the link, if anyone's interested: http://hp.jpsband.org/live/tests/ and the source code: http://hp.jpsband.org/svnroot/htmlpurif ... /index.php
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Alright, I've sort of resolved the issue, although I'd like to know why it was happening/
The reason why it was erroring out in the "random" place was because "blocked" output buffering was on. Turning it off allowed me to pinpoint the problem code:
By unrolling it into:
Things started working again. There were three instances of this in the code, each consistently setting off the segfault. Other than that, everything was running fine.
Maybe Zend Optimizer causing the problem? Will investigate.
The reason why it was erroring out in the "random" place was because "blocked" output buffering was on. Turning it off allowed me to pinpoint the problem code:
Code: Select all
$this->assertIdentical($output, $def->validate($input, $config, $context));Code: Select all
$result = $def->validate($input, $config, $context);
$this->assertIdentical($output, $result);Maybe Zend Optimizer causing the problem? Will investigate.
It's a zend engine thing.. in case you aren't aware - a segfault is when the application tries to write to memory that doesn't exist, or more specifically has not been allocated.
Perhaps the bug is when encompassing an object method call within an object method call like you have done.. I could see a recursion slip up (on the part of the php parser)
Perhaps the bug is when encompassing an object method call within an object method call like you have done.. I could see a recursion slip up (on the part of the php parser)
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Yeah, I'm vaguely aware of what segmentation faults are. Fixing them, however, is completely out of my league. I've never had to manage memory before, and I've never ever gotten a debugger to work.
I have strong evidence that Zend Optimizer 3.2.2 is at fault, as when I removed it from the php.ini, things started working, but adding it caused the segfault to happen again. Zend Optimizer 3.2.6 on Windows does not seem to have this problem, and I am currently installing 3.2.2 on my Windows box to test whether or not it's also a platform specific issue.
Edit: Nope, it's definitely Zend Optimizer 3.2.2. Crashes on my Windows box too! Not that this helps me, but I get a fuzzy feeling for knowing I'm not insane. O.o
I have strong evidence that Zend Optimizer 3.2.2 is at fault, as when I removed it from the php.ini, things started working, but adding it caused the segfault to happen again. Zend Optimizer 3.2.6 on Windows does not seem to have this problem, and I am currently installing 3.2.2 on my Windows box to test whether or not it's also a platform specific issue.
Edit: Nope, it's definitely Zend Optimizer 3.2.2. Crashes on my Windows box too! Not that this helps me, but I get a fuzzy feeling for knowing I'm not insane. O.o
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
It's already fixed, so there's really no point in reporting it. Otherwise, I would suppose: optimizer-bugs@zend.com