This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2]


Robert Collins wrote:
> 
> > -------- Original Message --------
> > Subject: FW: pthread_create problem in Cygwin 1.1.8-2
> > Date: Sun, 8 Apr 2001 15:40:43 +0200
> > From: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
> > To: "'earnie_boyd@yahoo.com'" <earnie_boyd@yahoo.com>
> >
> > Hi Earnie,
> >
> >
> > I am using:
> >
> > Reading specs from /bin/../lib/gcc-lib/i686-pc-cygwin/2.95.3-2/specs
> > gcc version 2.95.3-2 (cygwin special)
> >
> > Additional testing showes that if I insert a Sleep(500) in the
> > threadFunction() just before the return 0 it only crahes 3-5 times of
> > the 10
> > runs. Also, it crashes more often after fast repeated runs of the
> > program.
> > It also crashes more often on faster hardware (I have tested on two
> > machines, PII 400 and a PIII 700, both 256 MB RAM). Running only 1
> > thread
> > instead of two does not crash the program.
> 
> This smells like a threads/exception handling interaction issue of some
> sort.
> 
> It crashes for me, on i=99 at the same place. It crashes _every time_
> for me. Adding a sleep as you did made it crash 8/10 instead of 10/10.
> Removing the return 0; from within the try {} stopped it crashing
> completely.
> 
> Also, printf doesn't appear to be atomic and threadsafe (lines got
> interspersed). You might be hitting something there, but I doubt it
> (crashing in the wrong place).
> 
> some things to test/do:
> 
> 1) It's possible it's a problem with the thread exiting code, could you
> try using a pthread_exit call instead of return and report back.
> 
> 2) What cygwin1.dll are you using? I'm using a custom build ~= to the
> latest snapshot.
> 2a) Earnie - what are you testing with? (as a control point that doesn't
> see the fault).
> 

$ uname -a
CYGWIN_NT-4.0 DU211344 1.3.0(0.36/3/2) 2001-03-18 16:59 i686 unknown

> 3) What's the value of ecx when it dies? Mine is
> (gdb) info register
> eax            0x407004 4222980
> ecx            0xc0     192
> 
> 3a) Earnie - if you have a few minutes, can you put a breakpoint on the
> offending instruction, and report back the output o
> info registers

(gdb) info registers
eax            0x3	3
ecx            0x3	3
edx            0x3	3
ebx            0x1e51ec58	508685400
esp            0x1e51e430	0x1e51e430
ebp            0x1e51e4b8	0x1e51e4b8
esi            0xa0111f0	167842288
edi            0x1e51e968	508684648
eip            0x4010cc	0x4010cc
eflags         0x202	514
cs             0x1b	27
ss             0x23	35
ds             0x23	35
es             0x23	35
fs             0x38	56
gs             0x0	0
fctrl          0x27f	639
fstat          0x0	0
ftag           0xffff	65535
fiseg          0x0	0
fioff          0x0	0
foseg          0x0	0
fooff          0x0	0
fop            0x0	0



> info locals

No locals.

> info threads

(gdb) info threads
* 3 thread 266.0x172  threadFunction (arg=0x0) at Main.cpp:14
  2 thread 266.0x178  0x77f6828b in ?? ()
  1 thread 266.0x17e  0x77f678df in ?? ()
threadFunction (arg=0x0) at Main.cpp:14


> bt in each thread?
> 

(gdb) thread 1
[Switching to thread 1 (thread 266.0x17e)]
#0  0x77f678df in ?? ()

(gdb) bt
#0  0x77f678df in ?? ()
#1  0x77f1ced8 in ?? ()
#2  0x61004862 in _size_of_stack_reserve__ ()
#3  0x61004b3d in _size_of_stack_reserve__ ()
#4  0x61005283 in _size_of_stack_reserve__ ()
#5  0x404d14 in __main ()

(gdb) thread 2
[Switching to thread 2 (thread 266.0x178)]
#0  0x77f6828b in ?? ()

(gdb) bt
#0  0x77f6828b in ?? ()
#1  0x77f1cd92 in ?? ()
#2  0x61056026 in _size_of_stack_reserve__ ()
#3  0x61005731 in _size_of_stack_reserve__ ()
#4  0x77f04ee8 in ?? ()

(gdb) thread 3
[Switching to thread 3 (thread 266.0x172)]
#0  threadFunction (arg=0x0) at Main.cpp:14

(gdb) bt
#0  threadFunction (arg=0x0) at Main.cpp:14
#1  0x6106661c in _size_of_stack_reserve__ ()
#2  0x77f04ee8 in ?? ()

(gdb) step

(gdb) info registers
eax            0x0	0
ecx            0x407020	4223008
edx            0x1e51e498	508683416
ebx            0x1e51ec58	508685400
esp            0x1e51e430	0x1e51e430
ebp            0x1e51e4b8	0x1e51e4b8
esi            0xa0111f0	167842288
edi            0x1e51e968	508684648
eip            0x4011c0	0x4011c0
eflags         0x246	582
cs             0x1b	27
ss             0x23	35
ds             0x23	35
es             0x23	35
fs             0x38	56
gs             0x0	0
fctrl          0x27f	639
fstat          0x0	0
ftag           0xffff	65535
fiseg          0x0	0
fioff          0x0	0
foseg          0x0	0
fooff          0x0	0
fop            0x0	0

(gdb) info locals
No locals.

(gdb) info threads
* 3 thread 266.0x172  threadFunction (arg=0x0) at Main.cpp:20
  2 thread 266.0x178  0x77f6828b in ?? ()
  1 thread 266.0x17e  0x77f678df in ?? ()

(gdb) thread 1
[Switching to thread 1 (thread 266.0x17e)]
#0  0x77f678df in ?? ()

(gdb) bt
#0  0x77f678df in ?? ()
#1  0x77f1ced8 in ?? ()
#2  0x61004862 in _size_of_stack_reserve__ ()
#3  0x61004b3d in _size_of_stack_reserve__ ()
#4  0x61005283 in _size_of_stack_reserve__ ()
#5  0x404d14 in __main ()

(gdb) thread 2
[Switching to thread 2 (thread 266.0x178)]
#0  0x77f6828b in ?? ()

(gdb) bt
#0  0x77f6828b in ?? ()
#1  0x77f1cd92 in ?? ()
#2  0x61056026 in _size_of_stack_reserve__ ()
#3  0x61005731 in _size_of_stack_reserve__ ()
#4  0x77f04ee8 in ?? ()

(gdb) thread 3
[Switching to thread 3 (thread 266.0x172)]
#0  threadFunction (arg=0x0) at Main.cpp:20

(gdb) bt
#0  threadFunction (arg=0x0) at Main.cpp:20
#1  0x6106661c in _size_of_stack_reserve__ ()
#2  0x77f04ee8 in ?? ()

(gdb) step
Unable to Read Instructions at 0x6106661c

HTH,
Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]