Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 77490 invoked from network); 8 Feb 2007 07:39:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Feb 2007 07:39:19 -0000 Received: (qmail 66038 invoked by uid 500); 8 Feb 2007 07:39:25 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 66005 invoked by uid 500); 8 Feb 2007 07:39:25 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Delivered-To: moderator for modules-dev@httpd.apache.org Received: (qmail 17203 invoked by uid 99); 8 Feb 2007 01:38:49 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Subject: Re: Whitescreens when using a dir-conf merge function From: Ralf Mattes Reply-To: rm@mh-freiburg.de To: modules-dev@httpd.apache.org Cc: David Wortham In-Reply-To: <5280fae50702071716w170c5d51n19da2581f5e25265@mail.gmail.com> References: <5280fae50702071319o5af0d484j5e3873d076882695@mail.gmail.com> <45CA6AA6.1030109@toddesposito.com> <5280fae50702071646x2e6683d5saaac9ee7ed0c9b84@mail.gmail.com> <2A5A6510-10CD-49EA-A288-5089C37B43AB@webthing.com> <5280fae50702071716w170c5d51n19da2581f5e25265@mail.gmail.com> Content-Type: text/plain Date: Thu, 08 Feb 2007 02:38:11 +0100 Message-Id: <1170898692.5704.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-AntiVirus: checked by AntiVir MailGate (version: 2.1.0-19; AVE: 7.3.1.34; VDF: 6.37.1.52; host: forte.mh-freiburg.de) X-Virus-Checked: Checked by ClamAV on apache.org On Wed, 2007-02-07 at 18:16 -0700, David Wortham wrote: > Thanks Nick for the response. > > I looked up how to use gdb very quickly. I found out that the segfault is > happening at the same place I suspected. > > As I suspected, the lines causing the segfault are similar to: > Argh, can you _please_ post the real code? I hate to have to guess whether errors are errors or just typos ... > // dir_cfg contains mostly ints > struct intContainer > { > int x > } intContainer; > > /* ... later... in the merge function */ > static void* dir_cfg_merge_function (apr_pool_t* the_pool, void* > the_parent_dir_cfg, void* the_sub_dir_cfg) > { > intContainer* merged_dir_cfg = apr_pcalloc(p, 1*sizeof(intContainer)); > Where does 'p' come from? > int y = 1; > merged_dir_cfg->x = y; // this line causes a segfault... why? You never checked the return value of apr_pcalloc ... iff it's null you trigger a segfault. (Side note: the headers aren't too clear about the return value in case of failures ....). There's a debugging version of apr_pcalloc - that should help you debug your module. HTH Ralf Mattes > // this line would also segfault: > memcpy(, , 1*sizeof(int)); > return merged_dir_cfg; > } > > > > I still can't figure out what the issue is. Is there any way to tell if the > apr_pcalloc is failing? > > > > On 2/7/07, Nick Kew wrote: > > > > > > On 8 Feb 2007, at 00:46, David Wortham wrote: > > > > > > > > I am testing on LINUX, and that's where my whitescreens are showing up > > > (haven't started cross-platform testing yet). I have encountered > > > them in > > > the past and they culprit has always been a segfault. > > > I suspected a segfault-like error at the end of startup causing the > > > whitescreens, but I don't yet have a way to verify this. Also, I > > > don't know > > > where in my code the segfault could have occurred (unless the memory > > > allocation request was denied). > > > > Run it with -X under gdb. Do whatever it is that causes the segfault. > > Then get a backtrace from gdb. > > > > -- > > Nick Kew > >