Skip to content
Tcl Source Code History Of Ticket d3071887dbc7aeac
Login

History Of Ticket d3071887dbc7aeac

Artifacts Associated With Ticket d3071887dbc7aeac

  1. Ticket change [3a01934725] (rid 145720) by anonymous on 2016-03-18 16:46:22:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      When closing wish, process die at 
      
      		    pthread_cond_wait(&notifierCV, &notifierMutex);
      
      if cpu is supporting HLE/RTM. (xend instruction doesn't allow to use without
      xbegin)
      
      I.e. Tcl_FinalizeNotifier() is using combination
      
      	pthread_mutex_lock(&notifierInitMutex);
      	pthread_cond_wait(&notifierCV, &notifierMutex);
      	pthread_mutex_unlock(&notifierInitMutex);
      
      From history, this is clearly conversion mistake. notifierInitMutex should be
      notifierMutex (no Init).
      
      ---
      
       unix/tclUnixNotfy.c |    4 ++--
       1 file changed, 2 insertions(+), 2 deletions(-)
      
      diff -puN unix/tclUnixNotfy.c~fix-mutex-typo unix/tclUnixNotfy.c
      --- tcl8.6-8.6.5+dfsg/unix/tclUnixNotfy.c~fix-mutex-typo	2016-03-19 01:25:29.900145502 +0900
      +++ tcl8.6-8.6.5+dfsg-hirofumi/unix/tclUnixNotfy.c	2016-03-19 01:24:20.795871648 +0900
      @@ -417,7 +417,7 @@ Tcl_FinalizeNotifier(
       #ifdef TCL_THREADS
       	ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
       
      -	pthread_mutex_lock(&notifierInitMutex);
      +	pthread_mutex_lock(&notifierMutex);
       	notifierCount--;
       
       	/*
      @@ -460,7 +460,7 @@ Tcl_FinalizeNotifier(
       #endif /* __CYGWIN__ */
       	tsdPtr->waitCVinitialized = 0;
       
      -	pthread_mutex_unlock(&notifierInitMutex);
      +	pthread_mutex_unlock(&notifierMutex);
       #endif /* TCL_THREADS */
           }
       }
      _
      
    5. foundin initialized to: "8.6.5"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "c519df2ef36ff620b5da086214b301d7a3872019"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "49. Threading"
    15. title initialized to: "Fix SEGV in Tcl_FinalizeNotifier()"
    16. type initialized to: "Bug"
  2. Ticket change [6c88d21ccb] (rid 145722) by anonymous on 2016-03-20 12:13:48:

    1. icomment:
      Then another (better) candidate is the following, instead to remove
      notiferInitMutex protection.
      
               pthread_mutex_lock(&notifierInitMutex);
               pthread_mutex_lock(&notifierMutex);
               pthread_cond_wait(&notifierCV, &notifierMutex);
               pthread_mutex_unlock(&notifierMutex);
               pthread_mutex_unlock(&notifierInitMutex);
      
      Because notifierCV is protected by notifierMutex in other places
      (StartNotifierThread and NotifierThreadProc). So without notifierMutex
      lock, it would be wrong way (has possibility of race). And notiferInitMutex
      protects "notifierCount", etc.
      
      I tested the following, and it seems to be working.
      
      ---
      
       debian/changelog    |    6 ++++++
       unix/tclUnixNotfy.c |    2 ++
       2 files changed, 8 insertions(+)
      
      diff -puN unix/tclUnixNotfy.c~fix-mutex-typo unix/tclUnixNotfy.c
      --- tcl8.6-8.6.5+dfsg/unix/tclUnixNotfy.c~fix-mutex-typo	2016-03-19 01:56:33.736475677 +0900
      +++ tcl8.6-8.6.5+dfsg-hirofumi/unix/tclUnixNotfy.c	2016-03-20 20:42:03.421497517 +0900
      @@ -433,9 +433,11 @@ Tcl_FinalizeNotifier(
       			    "unable to write q to triggerPipe");
       		}
       		close(triggerPipe);
      +		pthread_mutex_lock(&notifierMutex);
       		while(triggerPipe != -1) {
       		    pthread_cond_wait(&notifierCV, &notifierMutex);
       		}
      +		pthread_mutex_unlock(&notifierMutex);
       		if (notifierThreadRunning) {
       		    int result = pthread_join((pthread_t) notifierThread, NULL);
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
    4. username: "[email protected]"
  3. Ticket change [957fa6bece] (rid 145754) by jan.nijtmans on 2016-03-21 12:12:15:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2457469.00851002"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Fixed now in all active branches. Thanks for the report and the fix!
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"