On Thu, Oct 1, 2009 at 11:57 PM, Diego Medina <[email protected]> wrote:
> Hi,
>
> Is it "ok" for two threads to access the same session?

I guess it is not supposed to happen, at least by reading
plugin/multi_thread/multi_thread.cc

The description says   "One Thread Per Session Scheduler"



drizzle_declare_plugin(multi_thread)
{
  "multi_thread",
  "0.1",
  "Brian Aker",
  "One Thread Per Session Scheduler",
  PLUGIN_LICENSE_GPL,
  init, /* Plugin Init */
  deinit, /* Plugin Deinit */
  NULL,   /* status variables */
  system_variables,   /* system variables */
  NULL    /* config options */
}

  -Diego


>
> Why do I ask? I am looking at
> https://bugs.launchpad.net/drizzle/+bug/439719
> "Drizzle crash when running random query generator"
>
> And I noticed that when drizzled crashes, there are two threads
> messing with the same session:
>
> The thread that crashed:
>
>
> Thread 1 (process 18572 local thread 0x18707):
> #0  0x00007fff82b231e6 in poll ()
> #1  0x00000001001245c9 in drizzled::slot::Listen::getProtocol
> (this=0x1005fed90) at slot/listen.cc:274
> #2  0x0000000100010e17 in main (argc=4, argv=0x7fff5fbff3b0) at 
> drizzled.cc:1574
>
> ...
>        session = (Session *) 0x101892e00
> ... (Go to the end of the email for full back trace)
>
>
>
> And then this thread is also using
>
> Thread 10 (process 18572 thread 0x293f):
> #0  0x00007fff82b416be in __semwait_signal_nocancel ()
> #1  0x00007fff82b412f4 in nanosleep$NOCANCEL ()
> #2  0x00007fff82b3b404 in usleep$NOCANCEL ()
> #3  0x00007fff82b4ff77 in abort ()
> #4  0x00007fff82b468c1 in __assert_rtn ()
> #5  0x000000010000db1a in Diagnostics_area::set_ok_status
> (this=0x1018669d8, session=0x101865e00, affected_rows_arg=0,
> found_rows_arg=0, last_insert_id_arg=0, message_arg=0x103646580 "Rows
> matched: 0  Changed: 0  Warnings: 0") at diagnostics_area.cc:89
> #6  0x0000000100005ce9 in Session::my_ok (this=0x101865e00,
> affected_rows=0, found_rows_arg=0, passed_id=0, message=0x103646580
> "Rows matched: 0  Changed: 0  Warnings: 0") at session.h:
> 1288
> #7  0x00000001001767cf in mysql_update (session=0x101865e00,
> table_list=0x101889f48, fiel...@0x101866ff8, valu...@0x101867298,
> conds=0x10188a3c8, order_num=0, order=0x0, limit=6, ignore=false) at
> sql_update.cc:637
> #8  0x000000010000ae0a in drizzled::statement::Update::execute
> (this=0x1028aeff0) at statement/update.cc:50
> #9  0x0000000100146e7b in mysql_execute_command (session=0x101865e00)
> at sql_parse.cc:934
> #10 0x0000000100147070 in mysql_parse (session=0x101865e00,
> inBuf=0x101889e10 "UPDATE `table0_innodb_int_autoinc` SET `int_key` =
> 6 WHERE `enum_not_null_key` = 0 LIMIT 6", length=90,
> found_semicolon=0x103646e28) at sql_parse.cc:1234
> #11 0x00000001001475fc in dispatch_command (command=COM_QUERY,
> session=0x101865e00, packet=0x10268b001 "UPDATE
> `table0_innodb_int_autoinc` SET `int_key` = 6 WHERE
> `enum_not_null_key` = 0 LIMIT 6", packet_length=90) at
> sql_parse.cc:210
> #12 0x0000000100104819 in Session::executeStatement (this=0x101865e00)
> at session.cc:727
> #13 0x0000000100104e99 in Session::run (this=0x101865e00) at session.cc:602
> #14 0x0000000100370012 in MultiThreadScheduler::runSession
> (this=0x10289d4f0, session=0x101865e00) at
> plugin/multi_thread/multi_thread.cc:102
> #15 0x000000010036ecc8 in session_thread (arg=0x101865e00) at
> plugin/multi_thread/multi_thread.cc:123
> #16 0x00007fff82aa5e8b in _pthread_start ()
> #17 0x00007fff82aa5d4d in thread_start ()
>
>
> You see, both thread are using the session 0x101892e00 .
>
> Thanks
>
>   -Diego
>
> ================================================
>
> Full back trace of the thread that crashed
>
> (gdb) bt full
> #0  0x00007fff82b231e6 in poll ()
> No symbol table info available.
> #1  0x00000001001245c9 in drizzled::slot::Listen::getProtocol
> (this=0x1005fed90) at slot/listen.cc:274
>        ready = 25769968
>        x = 1
>        retry = 4294967295
>        fd = -1
>        protocol = (class drizzled::plugin::Protocol *) 0x10183a200
>        error_count = 0
> #2  0x0000000100010e17 in main (argc=4, argv=0x7fff5fbff3b0) at 
> drizzled.cc:1574
>        plugins = (drizzled::plugin::Registry &) @0x1005fed00: {
>  plugin_map = {
>    _M_t = {
>      _M_impl = {
>        <std::allocator<std::_Rb_tree_node<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, drizzled::plugin::Handle*> > >> = {
>          <__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, drizzled::plugin::Handle*> > >> = {<No data fields>}, <No data
> fields>},
>        members of std::_Rb_tree<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, drizzled::plugin::Handle*>,std::_Select1st<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, drizzled::plugin::Handle*> >,std::less<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >
>>,std::allocator<std::pair<const std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> drizzled::plugin::Handle*> >
>>::_Rb_tree_impl<std::less<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > >,false>:
>        _M_key_compare = {
>          <std::binary_function<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,bool>> = {<No data
> fields>}, <No data fields>},
>        _M_header = {
>          _M_color = std::_S_red,
>          _M_parent = 0x101121720,
>          _M_left = 0x10289c6d0,
>          _M_right = 0x10111fbb0
>        },
>        _M_node_count = 29
>      }
>    }
>  },
>  function = {
>    udf_registry = {
>      item_map = {
>        _M_t = {
>          _M_impl = {
>            <std::allocator<std::_Rb_tree_node<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, const drizzled::plugin::Function*> > >> = {
>              <__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, const drizzled::plugin::Function*> > >> = {<No data fields>}, <No
> data fields>},
>            members of std::_Rb_tree<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, const drizzled::plugin::Function*>,std::_Select1st<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, const drizzled::plugin::Function*>
>>,std::less<std::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,std::allocator<std::pair<const
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, const drizzled::plugin::Function*> >
>>::_Rb_tree_impl<std::less<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > >,false>:
>            _M_key_compare = {
>              <std::binary_function<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,bool>> = {<No data
> fields>}, <No data fields>},
>            _M_header = {
>              _M_color = std::_S_red,
>              _M_parent = 0x10111fc90,
>              _M_left = 0x10289c570,
>              _M_right = 0x10111fc40
>            },
>            _M_node_count = 42
>          }
>        }
>      },
>      item_set = {
>        _M_t = {
>          _M_impl = {
>            <std::allocator<std::_Rb_tree_node<const
> drizzled::plugin::Function*> >> = {
>              <__gnu_cxx::new_allocator<std::_Rb_tree_node<const
> drizzled::plugin::Function*> >> = {<No data fields>}, <No data
> fields>},
>            members of std::_Rb_tree<const
> drizzled::plugin::Function*,const
> drizzled::plugin::Function*,std::_Identity<const
> drizzled::plugin::Function*>,drizzled::internal::RegistryMapCompare<const
> drizzled::plugin::Function*>,std::allocator<const
> drizzled::plugin::Function*>
>>::_Rb_tree_impl<drizzled::internal::RegistryMapCompare<const
> drizzled::plugin::Function*>,false>:
>            _M_key_compare = {<No data fields>},
>            _M_header = {
>              _M_color = std::_S_red,
>              _M_parent = 0x102899900,
>              _M_left = 0x10289c4d0,
>              _M_right = 0x10111fc10
>            },
>            _M_node_count = 19
>          }
>        }
>      }
>    }
>  },
>  listen = {
>    listen_list = {
>      <std::_Vector_base<const
> drizzled::plugin::Listen*,std::allocator<const
> drizzled::plugin::Listen*> >> = {
>        _M_impl = {
>          <std::allocator<const drizzled::plugin::Listen*>> = {
>            <__gnu_cxx::new_allocator<const
> drizzled::plugin::Listen*>> = {<No data fields>}, <No data fields>},
>          members of std::_Vector_base<const
> drizzled::plugin::Listen*,std::allocator<const
> drizzled::plugin::Listen*> >::_Vector_impl:
>          _M_start = 0x101120170,
>          _M_finish = 0x101120178,
>          _M_end_of_storage = 0x101120178
>        }
>      }, <No data fields>},
>    listen_fd_list = {
>      <std::_Vector_base<const
> drizzled::plugin::Listen*,std::allocator<const
> drizzled::plugin::Listen*> >> = {
>        _M_impl = {
>          <std::allocator<const drizzled::plugin::Listen*>> = {
>            <__gnu_cxx::new_allocator<const
> drizzled::plugin::Listen*>> = {<No data fields>}, <No data fields>},
>          members of std::_Vector_base<const
> drizzled::plugin::Listen*,std::allocator<const
> drizzled::plugin::Listen*> >::_Vector_impl:
>          _M_start = 0x10289c990,
>          _M_finish = 0x10289c9a0,
>          _M_end_of_storage = 0x10289c9a0
>        }
>      }, <No data fields>},
>    fd_list = 0x10289c760,
>    fd_count = 3,
>    wakeup_pipe = {103, 112}
>  }
> }
>        protocol = (class drizzled::plugin::Protocol *) 0x10183a200
>        session = (Session *) 0x101892e00
>
>
>
>
>
>
>
> --
> Diego Medina
> Web Developer
> http://www.fmpwizard.com
>



-- 
Diego Medina
Web Developer
http://www.fmpwizard.com

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to