views:

46

answers:

2

Hello,

I've a php script that's started each minute from cron.

It almost always runs without any problem, except for about 10 times within 24h.

The times it fails I get a segmentation fault like: bin/sh: line 1: 21815 Segmentation fault /usr/bin/myscript

The number after "line 1:" is always different.

I'm running: PHP 5.2.6-1+lenny8 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 14 2010 08:14:04)

Is this a problem with my version of PHP? Is there a way to debug this?

I have the feeling it crashes when the server load is high, but there's absolutely no prove for this.

Any feedback is welcome!

A: 

I believe there is no way that a script cause a segmentation fault, it must be coming from lower levels, you can try removing Suhosin patch or downgrading PHP and rerun the script again.

Behdad
A: 

I think you'll have to try to determine the cause of this yourself; of course you can try it in your test environment with different versions and/or without the patch.

And you can also do a debug build (in test environment, of course) and enable core dumps and get a debugger to see what it was doing when it failed.

In most cases this will spot it, but it may be that something is severely corrupting the runtime environment, in which case running against debug libraries may be your only chance.

If you can get it to happen reproducibly in a test environment, it's easy to identify the cause. Be prepared to use your debugger and step through the C (or is it C++?) code.

MarkR