Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-3289

thread creation failure in thread_group_resize ends up trying to destroy non existent thread

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Fault injection script introduced a failure in mmap while trying to create a thread:

      Induced fault in following backtrace:
      mmap
      pthread_create
      __wt_thread_create
      __thread_group_resize
      __wt_thread_group_create
      __wt_evict_create
      __wt_connection_workers
      wiredtiger_open
      start_run
      start_all_runs
      main
      __libc_start_main
      _start
      

      __thread_group_resize tries to error handle by destroying the thread group, which tries calling pthread_join on a non-existent thread, with a thread id of 0. Not all implementations of pthread library handle pthread_join(invalid-thread, NULL) gracefully, segfaulting with the following backtrace:

      (gdb) bt
      #0  0x0000003e6ce084f0 in pthread_join () from /lib64/libpthread.so.0
      #1  0x000000000045160f in __wt_thread_join (session=0x1121530, tid=0) at ../src/os_posix/os_thread.c:51
      #2  0x000000000048fbc1 in __thread_group_shrink (session=0x1121530, group=0x1111fb8, new_count=0) at ../src/support/thread_group.c:106
      #3  0x00000000004903ae in __wt_thread_group_destroy (session=0x1121530, group=0x1111fb8) at ../src/support/thread_group.c:318
      #4  0x000000000049008a in __thread_group_resize (session=0x1121530, group=0x1111fb8, new_min=1, new_max=8, flags=6) at ../src/support/thread_group.c:233
      #5  0x0000000000490292 in __wt_thread_group_create (session=0x1121530, group=0x1111fb8, name=0x54972a "eviction-server", min=1, max=8, flags=6, chk_func=0x42ec20 <__wt_evict_thread_chk>, run_func=0x42ec3f <__wt_evict_thread_run>, stop_func=0x42ee5e <__wt_evict_thread_stop>) at ../src/support/thread_group.c:291
      #6  0x000000000042f165 in __wt_evict_create (session=0x1121530) at ../src/evict/evict_lru.c:492
      #7  0x00000000004211d5 in __wt_connection_workers (session=0x1121530, cfg=0x7ffc17548870) at ../src/conn/conn_open.c:261
      #8  0x0000000000419103 in wiredtiger_open (home=0x1108040 "WT_TEST", event_handler=0x0, config=0x1108590 "create,cache_size=1G", wt_connp=0x7ffc17548b50) at ../src/conn/conn_api.c:2457
      #9  0x000000000040bf31 in start_run (wtperf=0x7ffc17548b20) at ../../../bench/wtperf/wtperf.c:2261
      #10 0x000000000040bb1b in start_all_runs (wtperf=0x7ffc17548b20) at ../../../bench/wtperf/wtperf.c:2175
      #11 0x000000000040d6e9 in main (argc=5, argv=0x7ffc17548db8) at ../../../bench/wtperf/wtperf.c:2712
      (gdb) f 2
      #2  0x000000000048fbc1 in __thread_group_shrink (session=0x1121530, group=0x1111fb8, new_count=0) at ../src/support/thread_group.c:106
      106			WT_TRET(__wt_thread_join(session, thread->tid));
      (gdb) p thread->tid
      $1 = 0
      (gdb) f 1
      #1  0x000000000045160f in __wt_thread_join (session=0x1121530, tid=0) at ../src/os_posix/os_thread.c:51
      51		ret = pthread_join(tid, NULL);
      (gdb) p tid
      $2 = 0
      

        Attachments

          Activity

            People

            Assignee:
            sulabh.mahajan Sulabh Mahajan
            Reporter:
            sulabh.mahajan Sulabh Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: