X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 15 Jul 2009 17:21:39 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: perl threads on 2008 R2 64bit = crash ( was: perl 5.10 threads 	on 1.5.25 = instant crash )
Message-ID: <20090715152139.GA694@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <20090714185506.GB12236@ednor.casa.cgf.cx> <20090714190436.GO27613@calimero.vinschen.de> <C795A3B019414FFC84425368B30B83F1@multiplay.co.uk> <20090714200631.GP27613@calimero.vinschen.de> <F24D5DF71BEC447DB0E080A0D6451ABB@multiplay.co.uk> <20090714205617.GA12534@ednor.casa.cgf.cx> <8541BCA91FF64580AA7A8065FBF9C938@multiplay.co.uk> <39B3B148DA514671BB2E1AE46946169C@multiplay.co.uk> <20090715000331.GA5635@ednor.casa.cgf.cx> <6D01817BC10A4430AFE7A590CC935C09@multiplay.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6D01817BC10A4430AFE7A590CC935C09@multiplay.co.uk>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Jul 15 01:41, Steven Hartland wrote:
>
> ----- Original Message ----- From: "Christopher Faylor" 
> <cgf-use...>

http://cygwin.com/acronyms/#PCYMTNQREAIYR

>> On Wed, Jul 15, 2009 at 12:36:56AM +0100, Steven Hartland wrote:
>>> This may or may not help:
>>>
>>> According to VC++ debugger it always dies with:
>>> Unhandled exception at 0x610d089d in perl.exe: 0xC0000005: Access violation reading location 0x00000004.
>>
>> No, sorry, it really doesn't help.  The VC++ debugger doesn't know how
>> to handle cygwin exceptions.
>
> Was just trying to get a hint of the area of the problem since gdb doesn't
> actually break when it happens this seemed to be the only way to get that
> info.
>
> Any pointers on how I can help narrow down the issue?

I can reproduce the problem on my 2008 R2 box.  It works fine on Windows
7 x64, though, so it's a Server thingy.

What happens is that this statement

  if ((*object)->magic != magic)

in the function thread.cc:verifyable_object_isvalid throws an exception
because *object is NULL.  This should be covered by the myfault handler
in this function but for some reason it isn't.

To debug this further I created a STC(TM)(*) which does the same as the
Perl testcase, just in pure C:

==== SNIP ====
#include <stdio.h>
#include <errno.h>
#include <pthread.h>

pthread_attr_t attr;

void *thr (void *arg)
{
  printf ("I'm a thread\n");
  return NULL;
}

int main()
{
  pthread_t t;
  int i, r;
  void *ret;

  fprintf (stderr, "Testing threads...\n");
  i = pthread_attr_init (&attr);
  printf ("i = %d\n", i);
  r = pthread_create (&t, &attr, thr, NULL);
  if (r)
    fprintf (stderr, "pthread_create: %d %s\n", errno, strerror (errno));
  else
    pthread_join (t, &ret);
  fprintf (stderr, "Testing done\n");
  return 0;
}
==== SNAP ====

The problem is, this testcase works fine, even on 2008 R2.  It must
have something to do with the way Perl creates thread or does its
own exception handling.  I just don't know what to look for.


Corinna


(*) http://cygwin.com/acronyms/#STC

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

