[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference smurf::dec_mls_plus

Title:dec_mls_plus
Moderator:SMURF::BAT
Created:Mon Nov 29 1993
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:534
Total number of notes:2544

444.0. "stack corruption problem in thread?" by SMURF::BAT (Segui la tua beatitudine) Tue Feb 04 1997 17:19

Date: Tue, 4 Feb 1997 11:53:43 -0500
From: tammy@tsc.cxo.dec.D5NET.dec.com (Tammy Sandefur)
To: thomson@kamlia.enet.dec.com
Subject: critical help please

hi Bat,


  I just received this from another new-b out at trident. Then I get a call
from Jr saying they need info by due date (friday).  

  My response (oh well) I wanted to say take a number, but I held back.

from steve 

Essentially, I have a c++ class that gets instantiated before I make a
pthread_init.  When I go to make a call against that class from within a
thread, I get a segment violation.  If, however, I make a call against
that class within my main(), it executes flawlessly.

I've ensured that I've done the proper typecasting and I've ensured that
the class variable I am using is valid.  I've ensured that the variable
is
even the *exact* same variable in the main() and the thread.  For
instance, my class is sServerClass, with it's instantiation being
pServer.
Within main():  pServer->sendToClient(...) works just fine.  Within the
thread, pServer->sendToClient(...) causes a segment violation.
main::pServer and thread::pServer are exactly the same value.

I compile all my sources that are threaded with -D_REENTRANT, and pass
"-Wthreads -lpthreads -lmach -lc_r" to the linking stage.  I use gcc
2.7.2.1.  I do, however, use dec's linker.

error When the program does finally segment violate, I actually get an
exception error from the dce/thd subsystem (invalid memory address).
 

Thanks 

          
Tammy Sandefur
Digital Equipment
Ultrix & Osf Network Support
tammy@tsc.csc.cxo.dec.com
T.RTitleUserPersonal
Name
DateLines
444.1pthread_attr_setstacksizeSMURF::BATSegui la tua beatitudineTue Feb 04 1997 17:2027
Date: Tue, 4 Feb 1997 13:59:42 -0500
From: tammy@tsc.cxo.dec.D5NET.dec.com (Tammy Sandefur)
To: thomson@kamlia.enet.dec.com
Subject: more info

I've been working on the problem I described to you earlier about my
threads not executing a method properly.  I managed to find a workaround.

If I go in and strip the method down to its BARE calls (ie, strip out any
superflous debugging information, streamline the flow a bit, ultimately
generating a smaller footprint), then the method works.  Which leads me to
believe that it is a stack corruption problem.

Well, I used pthread_attr_setstacksize() to set the stack size of the
thread to be 640k, just in case (yes, I went a bit on the extreme side),
but that didn't seem to have any affect ...

Is there an implicit limit to a method call in a thread?  Is there
something I'm doing wrong with my pthread_attr_setstacksize() call? (yes,
I do pthread_attr_create( &variable ); pthread_attr_setstacksize(
&variable, 640*1024); pthread_create( ..., variable ...) ) ...

          
Tammy Sandefur
Digital Equipment
Ultrix & Osf Network Support
tammy@tsc.csc.cxo.dec.com
444.2DECthreads conference had some suggestionsSMURF::BATSegui la tua beatitudineWed Mar 12 1997 17:071
    I sent Tammy the gist of note 368 and the pthreads notesfile.