2e87daf Ticket #48005 - ns-slapd crash in shutdown phase

Authored and Committed by nhosoi 4 years ago
    Ticket #48005 - ns-slapd crash in shutdown phase
    
    Description: There was a small window that long running tasks access its
    own task object after it's aready released by main thread in the shutdown
    period.  This patch adds refcounter to such threads and make destructor
    wait until the counter becomes 0.  Plus, the shutdown check is added to
    their task callbacks.
    
    Following tasks are updated by this patch:
      slapd/task.c:                         "fixup tombstones"
      posix-winsync/posix-winsync-config.c: "memberuid task"
      replication/repl5_replica_config.c:   "cleanallruv"
      replication/repl5_replica_config.c:   "abort cleanallruv"
      syntaxes/validate_task.c:             "syntax validate"
      automember/automember.c:              "automember rebuild membership"
      automember/automember.c:              "automember export updates"
      automember/automember.c:              "automember map updates"
      linkedattrs/linked_attrs.c:           "fixup linked attributes"
      memberof/memberof.c:                  "memberof task"
      schema_reload/schema_reload.c:        "schema reload task"
      usn/usn_cleanup.c:                    "USN tombstone cleanup task"
    
    Following tasks are already covered:
      slapd/task.c: "import"
      slapd/task.c: "index"
      slapd/task.c: "upgradedb"
    
    Following tasks are processed in an ordinary worker thread; no need to change
      slapd/task.c: "sysconfig reload"
      slapd/task.c: "export"
      slapd/task.c: "backup"
      slapd/task.c: "restore"
    
    (cherry picked from commit ab2e26de21beb5a92d2a18ab5a20db9637b83c7a)
    (cherry picked from commit eebbabbaba8f024671158f527a169fc378ff01d6)
    
    Conflicts:
    	ldap/servers/plugins/memberof/memberof.c
    
        
file modified
+42 -5