Hi all,

since I upgraded to Drupal 4.7 one month ago, my system go screwed 2 times with an Apache "exit signal Segmentation fault".

I´ve searched the forum for help, but seems that no one have a solution to this issue.

http://drupal.org/search/node/child+pid+exit+signal+Segmentation+fault+%...

From the wikipedia:

In short, a segmentation fault occurs when a program attempts to access a memory location that it is not allowed to access, or attempts to access a memory location in a way that is not allowed (e.g., attempts to write to a read-only location, or to overwrite part of the operating system).

Could this be caused from any of the core modules? Is there any form to debug this?

Thanks in advance, Simon.

Comments

styro’s picture

a seg fault would indicate the problem isn't really with Drupal (or anything else written in PHP) at all. PHP is a high level interpreted language - it doesn't directly access memory the same way a lower level language does.

While there is a chance it is triggered by a specific part of Drupal, PHP should be handling that without crashing anything. Really it is either possibly a hardware/kernel problem or more likely a bug in other code written in a lower level language (eg C, C++ etc) - my guess at prime culprit would be PHP (it doesn't exactly have the reputation for best written language out there) with Apache being a distant second. A bug in mod_php can bring down Apache.

I would ask for help from the PHP and Apache guys first.

You could try running hardware diagnostics (especially memory checkers) or upgrading PHP, and if that doesn't help try upgrading Apache or your OS. I take it your server isn't over heating etc?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

SimonVlc’s picture

Hi styro,

I would be on your side if no other users had talked about this issue on drupal.org.

I´m more inclined to think that is a drupal related problem because I run only 3 sites on this server (a dedicated one with 800Mb of free ram). Two drupal sites (4.6, 4.7) and one other site that´s uses cgis but never gives problems in the past (5 years). Added to this, the problem started only after installing 4.7 (after 1 year of running smoothly).

Thanks anyway. I would do my best to find the problem.

Simon.

Heine’s picture

Where on your site does it happen? On some php versions Apache is known to segfault when a function recurses to deep. I can imagine other causes as well.

--
When your problem is solved, please post a follow-up to the thread you started.

styro’s picture

I would be on your side if no other users had talked about this issue on drupal.org.

My point was:

Just because Drupal can trigger a segfault doesn't mean the actual bug is in Drupal. There should be no way for PHP code to do that (it doesn't allocate memory) - if it can do so reproducibly with legal PHP code then the bug is in PHP (PHP doesn't have a good reputation for code quality). If PHP code is recursing too deep (for example), PHP should catch that before it segfaults and produce an error message.

Sure, Drupal can work around a bug in PHP by trying harder to avoid it (and probably already does so in many places) - but it doesn't mean the bug is in Drupal. There is a difference between a workaround and a bug fix.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

rwelti’s picture

I am a fresh 4.7 install as of about one week ago.

My segmentation faults come when I do "Save Settings" from various Administration and Settings panels, mostly Image-related.

I just installed Image, Image_assist, and tinymce and got inline embedded images going in WYSIWYG editor areas with success.

It was when I began to more fully explore the capabilities of img_assist, Image (and the Image Gallery that came with it) and tinymce (spellcheck and compressor add-ons) that it began to happen.

No messages in the Administration Logs area, even on full logging, however in the Apache "errors" file I see the segmentatation faults.

I do a "tail -f" on the error file and literally see the seg fault happen at the time I press Save Settings.

[Tue May 16 14:46:29 2006] [notice] child pid 5947 exit signal Segmentation fault (11)

The save in question does seem to take effect, by the way.

Another symptom of this problem that I have seen in the forums is "Blank page on save settings" -- a blank page is the result of a httpd child process that dies! Anyone getting "blank page"s should investigate this using Apache's error log as described above.

I am trying to find out, by backing out my modules one by one, what the offending module / plugin was...

I already upped my Memory setting in php.ini from the default 8M to 32M as a test, no effect.

Any tips / techniques are appreciated.

Russ Welti

You know I don't repeat gossip, so listen *closely*

styro’s picture

Is is possible that it is a GD2 problem? What happens if you try ImageMagick instead? (or vice versa?)

eg GD2 is compiled into PHP, while IM is a command line utility. That might have a bearing on whether or not the graphics toolkit can bring down Apache.

Do you have any details on the OS/Distro/version etc?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

rwelti’s picture

I'm using GD, because it must be the default in Image...
I'd actually like to switch Image to use ImageMagic (since my GD has no GIF support). Or at least try doing it...
How does one switch?
Thanks Russ

styro’s picture

But from memory you basically copy an inc file from your image module directory to your includes directory, and do some configuration in admin/settings including the path to the convert utility.

http://drupal.org/node/19577

I had tried it out with 4.6 and got it working, but went back to GD2 because it worked better for us. But that isn't the objective here - just to test whether or not GD2 is what is crashing Apache on your server.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

rwelti’s picture

Thanks, I haven't looked at the Image home page, etc. Will do tomorrow.

rwelti’s picture

Deactivated img_assist and tinymce and still seg V when I try to save Image settings from Admin / Settings / Image.

I put echo statements in /drupal/index.php and it **isn't even getting that far**

I think the form that is being submitted is inherently invalid or something because again, I can't seem to get any "echo" statements to print out from any place like index.php or modules/image/image.module.

OH: tried changing themes in case it was theme-related. Same behaviour on other theme... is there a "bulletproof" or "minimal" theme to test with??

Thanks much
Russ Welti

ps here is the HTML of the Image Settings form which crashes:


<form action="/drupal/?q=admin/settings/image"  method="post" id="image_settings_form">
<div><input type="hidden" name="edit[image_updated]" id="edit-image_updated" value="1147820191"  />
<fieldset><legend>File paths</legend><div class="form-item">
 <label for="edit-image_default_path">Default image path:</label>
 <input type="text" maxlength="128" name="edit[image_default_path]" id="edit-image_default_path"  size="60" value="images" class="form-text" />
 <div class="description">Subdirectory in the directory "<em>files</em>" where pictures will be stored. Do not include trailing slash.</div>
</div>
</fieldset>
<fieldset><legend>Image sizes</legend><div class="form-item">

 <table>
 <thead><tr><th>Label</th><th>Width</th><th>Height</th> </tr></thead>
<tbody>
 <tr class="odd"><td><div class="form-item">
 <input type="text" maxlength="128" name="edit[image_sizes][0][label]" id="edit-image_sizes-0-label"  size="25" value="thumbnail" disabled="disabled" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][0][width]" id="edit-image_sizes-0-width"  size="5" value="100" class="form-text" />

</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][0][height]" id="edit-image_sizes-0-height"  size="5" value="100" class="form-text" />
</div>
</td> </tr>
 <tr class="even"><td><div class="form-item">
 <input type="text" maxlength="128" name="edit[image_sizes][1][label]" id="edit-image_sizes-1-label"  size="25" value="preview" disabled="disabled" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][1][width]" id="edit-image_sizes-1-width"  size="5" value="640" class="form-text" />
</div>
</td><td><div class="form-item">

 <input type="text" maxlength="5" name="edit[image_sizes][1][height]" id="edit-image_sizes-1-height"  size="5" value="640" class="form-text" />
</div>
</td> </tr>
 <tr class="odd"><td><div class="form-item">
 <input type="text" maxlength="128" name="edit[image_sizes][2][label]" id="edit-image_sizes-2-label"  size="25" value="tiny" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][2][width]" id="edit-image_sizes-2-width"  size="5" value="40" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][2][height]" id="edit-image_sizes-2-height"  size="5" value="40" class="form-text" />

</div>
</td> </tr>
 <tr class="even"><td><div class="form-item">
 <input type="text" maxlength="128" name="edit[image_sizes][3][label]" id="edit-image_sizes-3-label"  size="25" value="" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][3][width]" id="edit-image_sizes-3-width"  size="5" value="" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][3][height]" id="edit-image_sizes-3-height"  size="5" value="" class="form-text" />
</div>
</td> </tr>

 <tr class="odd"><td><div class="form-item">
 <input type="text" maxlength="128" name="edit[image_sizes][4][label]" id="edit-image_sizes-4-label"  size="25" value="" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][4][width]" id="edit-image_sizes-4-width"  size="5" value="" class="form-text" />
</div>
</td><td><div class="form-item">
 <input type="text" maxlength="5" name="edit[image_sizes][4][height]" id="edit-image_sizes-4-height"  size="5" value="" class="form-text" />
</div>
</td> </tr>
</tbody></table>

 <div class="description">Select various pixel dimensions, "thumbnail" and "preview" are required.</div>
</div>
</fieldset>
<input type="submit" name="op" value="Save configuration"  class="form-submit" />
<input type="submit" name="op" value="Reset to defaults"  class="form-submit" />
<input type="hidden" name="edit[form_id]" id="edit-form_id" value="image_settings_form"  />

</div></form>

styro’s picture

OK, it seems just running image module stuff blows up.

Without looking it up I'm not sure how to do this, but maybe you could disable GD2 in your PHP config then try running /admin/settings/image again. The objective is to try and get a Drupal error complaining about GD2 support being missing rather than an Apache segfault. If disabling GD2 changes the segfault into a Drupal error, then the blame is likely to be a broken GD2 in your PHP install.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

rwelti’s picture

It is significant that Image and Img_assist were working fine right after I installed them. I was browsing and uploading images to the server and referring to them fine.

Only at some point when I started trying to upload GIF files (my GD2 does not have GIF support) did the problem begin. The first sign of problems was trying to make thumbnails of GIF files. But the GIF files themselves uploaded and displayed OK at full size. But

I found that this is an open critical bug so I hope someone else can try to figure it out.
I'm giving up.

Thanks for considering the problem. I suspect other people are going to encounter it:

Saving configuration on some modules causes Apache segmentation fault
(see http://drupal.org/node/57783 )

R. Welti

styro’s picture

mentioned Solaris as your OS. I suspect that is significant.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

mswchan’s picture

Hi,

Same symptom, [notice] child pid 5947 exit signal Segmentation fault (11), when LDAP userid trying to login. My Apache didn't die however.

I have reported this 2 days ago in :
http://drupal.org/node/108294

I also tried hack of Sean:
http://drupal.org/node/63181#comment-180447
no luck for my case.

Please help.

Michael

stella’s picture

Hi,

I've encountered the same problem enumerous times since I installed drupal. However it only ever happens when I go to add content - any type of content, page, story, image, etc. I've found that if I drop the database (after backing it up of course!) and then recreate it using the database create file, then the seg fault no longer occurs. However, as soon as I reinstate the database from my backup it stops working again.

So I started with a clean db install then and re-enabled my modules one by one. I think the problem might be due to having both the apparel (ecommerce) module and the menu module enabled. As soon as I enable/disable either one of those the seg fault no longer occurs. The only other modules enabled are the ones enabled by default (including page, story, etc) and the core ecommerce ones.

It's a shame this problem is happening because I can't continue using drupal if this continues.

Stella

kevinconaway’s picture

I have Image + Img_assist as well and when I enable apparel, I get segfaults (blank page) trying to add a "page" or "image" content.

Is there a resolution for this?

Thanks,

Kevin

Zane Dog’s picture

I had this problem with Drupal 4.7 -- a persistent segv in /node/add/page after installing apparel. I am using stock php4 on Debian sarge.

The segv happens in _menu_sort, when it is called via usort during some recursion in menu_parent_options. The recursion in the case I observed is only 4 or 5 levels deep, so we are not blowing out memory because of deep recursion.

This bug makes no sense at all in the realm of PHP, it has to be a bug in the interpreter.

I worked around the bug by inserting a meaningless line of code in _menu_sort. My theory is that it permutes the interpreter's working environment in such a way as to avoid tickling the bug. I am breathing a sigh of relief because I can create pages again, but at the same time I've got a queasy feeling the bug will crop up again elsewhere.

Here is the change I made in includes/menu.inc, around line 992. The original code looks like this

function _menu_sort($a, $b) {
$menu = menu_get_menu();

I changed it to look like this

function _menu_sort($a, $b) {
$x = NULL; /* added by Seine Dog -- makes no sense but prevents a segv */
$menu = menu_get_menu();

I'd be interested to know whether this works for anyone else.

Zane Dog’s picture

Bad news: After I added a bunch of new menus the segv in _menu_sort came back.

Good news: I made it go away again by replacing $x = NULL (see above) with print_r("").

I hate this voodoo programming. Maybe it's time to switch to php 5.

styro’s picture

switch away from PHP altogether ;)

I'm only half kidding though - if it wasn't for Drupal, I would've dropped PHP a long time ago. Yes Drupal is so good that I will grudgingly tolerate using PHP because of it.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ
Example Knowledge Base built using Drupal

chiggsy’s picture

Yes, I am glad i am not the only one. Only Drupal and Symfony keep me using this language. If i cant do the project using either one of them, then i'm not doing it ;)

Zane Dog’s picture

I found an ancient PHP bug report that seems very similar to the bug I observed and described here. I wonder if it's still lurking after all this time. There's no indication that the bug was ever pinned down and fixed, it's just "can't reproduce it with CVS head" or something to that effect. See http://bugs.php.net/bug.php?id=8463

By the way, it looks as though something like this is happening in PHP 5 too, see discussion in http://drupal.org/node/80607

SpiesInOrbit’s picture

I am having trouble with the adding content > poll module doing this. The print_r("") half worked for me. It worked for a second then when I submitted the form it started again.

Steve
http://myonehitwonder.com/

SpiesInOrbit’s picture

I have posted on this before with a crap ass solution...

http://drupal.org/node/57783

The $x = NULL; solution worked for me when it started again.

The real perplexing thing is in my case that I am running several sites all 4.7 all running the same stuff through the same server. Two of my sites were experiencing these issues. This solution...only fixed one of the sites.

This time my error happened on the /node/add/poll page. It occurred on two of my 10 sites. Once I made the change to the menu.inc code, it cleared up only one of the 2 sites. The odd thing is that the other continues to have the same problem on the same page. All my other sites still work. The $x exits with a value of NULL before being explicitly set, so I'm not certain what that is and why it would work on one, but not the other.

Could it be a memory level setting in apache2 or the php.ini?

Steve
http://myonehitwonder.com/

budda’s picture

I've just upgraded a site from 4.6 to 4.7 and am having the same Segfault problems when saving settings. I've tried disabling the image.module but the problem still occured.

I've not put the $x = NULL; in as this seems ridiculous for a fix! Did anybody come to a proper solution for this?

I've tried running a MySQL repair on the 'variables' table but this achieved nothing.

After going backwards and uninstalling recent modules I upgraded to 4.7, I noticed the problem goes away when I deactivated both buddylist.module and img_assist. Enabling either of these again caused the Apache2 segfault.

The dev server is running Linux Fedora Core 3 / PHP 4.3.10 / Apache 2.0.53 / GD 2.0.28 (compatible).

--
Ixis (UK) providing Drupal consultancy and Drupal theme design.

rwelti’s picture

It has been a long time, but I recall that these problems went away for me when I
changed the image handling method from GD2 to ImageMagick, from somewhere
in the admin section of Drupal.

Also, img_assist was problematic for me.

Thost of us that used Mac OS 8/9 remember Extension overload' where OS
extensions (read modules) would eventually conflict and freeze the OS, and
your only avenue of fixing was to reboot with all extensions OFF and then
add them back one-at-a-time hoping to find the pair (or more) that did not
like each other. YUCK! That was painful.

kpander’s picture

I've run into the same problem as a number of other people here, namely that adding a new node (whether a core node such as 'story' or one of my own custom ones) causes a seg fault. Apache dies and is unhappy, and so am I.

I traced the location of where the crash occurs back to the _menu_sort() function in menu.inc. I'm running Drupal 4.7.4 and tested with only the default modules in order to remove any potential problems caused by my own code.

By *not* accessing the $menu variable by reference, the problem seems to have been resolved. This scares me because it's not making any sense to me as to why it's working. :(

In _menu_sort(), I changed this:

$a = &$menu['items'][$a];
$b = &$menu['items'][$b];

to this:

$a = $menu['items'][$a];
$b = $menu['items'][$b];

And all of a sudden, everything is working fine again. Other than tempting fate by adjusting the core, can anyone see how I might be causing more problems for myself in the future? Am I missing something important here?

(btw: this is my first post here... I've been a Drupal convert for the past 6 months and am constantly impressed by the foundation here!)

Kendall
Abandoned Industry! :: http://invisiblethreads.com/galleries ::

seanbfuller’s picture

This hack seems to be working for me so far. I posted it at http://drupal.org/node/57783#comment-167102 in the hopes someone more familiar with menu.inc could comment on the possible consequences of such a hack.

--------------------
Sean B. Fuller
www.seanbfuller.com
www.tractiv.com

--------------------
Sean B. Fuller
www.seanbfuller.com

mswchan’s picture

Hi,

Same symptom, [notice] child pid 5947 exit signal Segmentation fault (11), when LDAP userid trying to login. My Apache didn't die however.

I have reported this 2 days ago in :
http://drupal.org/node/108294

I also tried hack of Sean:
http://drupal.org/node/63181#comment-180447
no luck for my case.

Please help.

Michael

ghoti’s picture

I'm on a freshly minted virtual machine with Apache 2.2.4, PHP 5.2.0, Drupal 5.1. And just running install.php gets me a segfault, same as everyone else. The catch is ... This is install.php. I don't even have database tables installed, let alone a collection of modules I can selectively remove until things behave. I get no errors other than the segfault notice.

I agree with the comments above -- this most definitely looks like a PHP or Apache thing that's being tickled by something in Drupal, not a problem with Drupal.

I've removed all non-essential PHP extensions, to no avail. I'm now recompiling everything of apache and php from scratch, just in case something's hinky there. If that doesn't work, the next step will be to reinstall PHP as a CGI instead of an Apache module.

Paul Chvostek - it.canada - climbers.org

styro’s picture

what process/threading model are you using for Apache? I'm not familiar with the state of things in Apache 2.2, but does PHP still recommend processes vs threads?

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ

ghoti’s picture

This was prefork. I was under the gun and unable to play with this, so I installed on an existing Apache 2.0 server (also prefork).

This feels like a GD thing, but I'm not really sure yet. The host on which this was happening is an Opteron, but I'm building everything from source (I'm in FreeBSD). I'll play with it again in the next few days and update this thread.