Hi,

thanks for the great bug report.

I am not able to reproduce this issue, but i think i came up with a fix. If
you want to check out the sources then you can get them here:
https://github.com/cruppstahl/hypertable branch "v0.9.5"

This is the commit:
commit 2572b5dcb524e1c36dc23307c37784fd34c1bdde
Author: Christoph Rupp <[email protected]>
Date:   Wed Apr 25 18:54:11 2012 +0200

    issue 827: fixed deadlock when scanning secondary indices

And here's the diff:

diff --git a/src/cc/Hypertable/Lib/IndexScannerCallback.h
b/src/cc/Hypertable/Li
index 70ffda7..1b37127 100644
--- a/src/cc/Hypertable/Lib/IndexScannerCallback.h
+++ b/src/cc/Hypertable/Lib/IndexScannerCallback.h
@@ -118,13 +118,12 @@ static String last;
     }

     virtual ~IndexScannerCallback() {
-      ScopedLock lock(m_mutex);
-      if (m_mutator)
-        delete m_mutator;
       foreach (TableScannerAsync *s, m_scanners)
         delete s;
       m_scanners.clear();
       sspecs_clear();
+      if (m_mutator)
+        delete m_mutator;

Can you please give it a try and see if this helps?

Thanks
Christoph

2012/4/24 gcc.lua <[email protected]>

> user thread  logic like follow:
> TableScannerPtr aScanner = tbSourcelist-
> >create_scanner( specbuilder.get(), 5000 );
>  while( aScanner->next( gotCell ) )
>  {
>         .....
>  }
>
> dead lock between user thread and scanner thread:
>
> 1. user thread TableScanner
>
>    TableScannerAsync::~TableScannerAsync() {
>  try {
>    cancel();
>    wait_for_completion();
>  }
>  catch (Exception &e) {
>    HT_ERROR_OUT << e << HT_END;
>  }
>  if (m_use_index) {
>    delete m_cb;//<=========================dead lock entry
>    m_cb = 0;
>  }
> }
> /////////////////////////////////////////
>   virtual ~IndexScannerCallback() {
>  ScopedLock lock(m_mutex);//<=========  user thread got this
> IndexScannerCallback::m_mutex
>      if (m_mutator)
>        delete m_mutator;
>
>      foreach (TableScannerAsync *s, m_scanners)
>        delete s;//dead lock 1<=============user thread wait
> TableScannerAsync::m_mutex
>
>
> 2. scanner thread
>
>  void TableScannerAsync::handle_result(int scanner_id, EventPtr
> &event, bool is_create) {
>
>  bool cancelled = is_cancelled();
>  ScopedLock lock(m_mutex);<============scanner thread got
> TableScannerAsync::m_mutex
>  ScanCellsPtr cells;
>
>    . . . . . .
>  maybe_callback_ok();<================call  m_cb->scan_ok(this,
> cells);
>
> }
> //////////////////////////////
>  class IndexScannerCallback : public ResultCallback {
>
>    virtual void scan_ok(TableScannerAsync *scanner, ScanCellsPtr
> &scancells) {
>      bool is_eos = scancells->get_eos();
>      String table_name = scanner->get_table_name();
>
>      ScopedLock lock(m_mutex);//dead lock 2<============scanner
> thread wait IndexScannerCallback::m_mutex
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hypertable Development" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/hypertable-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Hypertable Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hypertable-dev?hl=en.

Reply via email to