Thanks for pointing this out, I just filed issue
419<http://code.google.com/p/hypertable/issues/detail?id=419>for this
one.  Did you discover this by hitting the assert?  Or was it just
by reading the code?  The reason I ask is because I've never hit that assert
and I'm wondering if this is one of those bugs that never crops up in
practice.

- Doug

On Sun, Mar 28, 2010 at 8:12 PM, Alen Wu <[email protected]> wrote:

> The methods "int Comm::connect(struct sockaddr_in &addr,DispatchHandlerPtr
> &default_handler_ptr)"
> and
> "int Comm::connect(struct sockaddr_in &addr, struct sockaddr_in
> &local_addr, DispatchHandlerPtr &default_handler_ptr)"
> are not thread-safe, they would cause asserion failed (read color
> highlighted) in the
> "
>  void HandlerMap::insert_handler(IOHandler *handler) {
>       ScopedLock lock(m_mutex);
>       assert(m_handler_map.find(handler->get_address()) ==
> m_handler_map.end());
>       m_handler_map[handler->get_address()] = handler;
>     }
> "
>
> Since the above two "Comm::connect(...)" methods only use "bool
> HandlerMap::contains_handler(const sockaddr_in &addr)" method to
> to ensure there is not a connection to the same destination, and then use "
> void HandlerMap::insert_handler(IOHandler *handler)" to insert
> the connection information, but these two
> "HandlerMap::contains_handler(...)" and "HandlerMap::insert_handler(...)"
> can not provide a atom
> operation, so the assertion in the "HandlerMap::insert_handler(...)" would
> happen if  two threads connect to a same destination on the same time.
>
>
>  --
> 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]<hypertable-dev%[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