Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6225ab7c767ec3a50933227aa68b954ee949d3be
Ticket: 218727ffffffffffffffffffffffffffffffffff
Stack overflow in multi-threaded application
User & Date: nobody on 2000-10-26 01:04:38
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1911 Bug
    Version: 8.1b3
    SubmitDate: '1999-04-20'
    LastModified: '2000-01-11'
    Severity: SER
    Status: Released
    Submitter: pat
    ChangedBy: hobbs
    RelatedBugIDs: 1966
    OS: SunOS
    OSVersion: 2.5.1
    Machine: Sparc
    FixedDate: '2000-01-11'
    FixedInVersion: 8.3b2
    ClosedDate: '2000-10-25'
    
    
    Name: matt swift
    
    CVS: April 19, 12:52 +0100
    
    Comments:
    The regexp that seemed to cause the problems was:
        
        regexp {([^ ]*)[ ]*([^ ]*)([ ]*HTTP/[0-9]\.[0-9])?} $value  all method
        file protocol
        
        With a value of "GET / HTTP/1.0".
    
    ObservedBehavior:
    I'm sorry if this report is a little vague, I'd be happy to supply you
        with further information if required.
        
        Basically, we have a www-to-LDAP gateway server application that accepts
        multiple http connections. Each connection is represented by a single
        thread (our own Pthreads package) containing a Tcl interpreter for
        processing the request and returning the results in a suitable html
        page.
        
        The server used to work under Tcl8.0. However, it now core dumps
        somewhere deep in the bowels of the Tcl byte compiler/executer due to
        the byte-compiled code being scribbled on by something. I tested the
        server application using a memory use diagnostic utility called Purify
        which showed that the regexp package (this has recently been replaced
        hasn't it?) was exceeding the thread's allocated stack space of 128KB.
        This is alot of memory for a single thread! Everything works fine if I
        increase the per-thread stack space to 256KB.
        
        I noticed that the callstack can become quite large during
        byte-compiling and was wondering whether the new regexp package was
        either very recursive or included a large number of big local variables.
        
        To summarise, I'm not sure whether this is a bug or not. However, it
        caught me by surprise and took a long time to debug, so it might be
        worth mentioning in the release notes.
    
    DesiredBehavior:
    Regexp not requiring such a large stack space.
    
    
    
    There is a new regexp engine for 8.3b1 that uses much less stack
    space (currently in CVS).  This might fix this problem, but we
    might want to increase default stack allocation for threads on
    certain systems. 
    -- 10/21/1999 hobbs
    A slight modification was made for setting the stack size in 8.3b2,
    so that the user can set the value from the makefile.  However, the
    user must set TCL_THREAD_STACK_MIN to something to get the stack setting
    behavior (it leaves it to the defaults otherwise).
    
    See tclUnixThrd.c in 8.3b2 for more.  This may be better parametrized
    in the future (runtime option?).  
    -- 01/11/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.1b3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "Stack overflow in multi-threaded application"
  11. type changed to: "Bug"