Boost logo

Boost Users :

Subject: [Boost-users] Boost::Asio crashes all the time when starting multiple connections
From: Andi Clemens (andi.clemens_at_[hidden])
Date: 2011-06-14 05:51:11


Hi,

I have started to write a ProxyServer that analyzes TDS-packages sent from
the Microsoft SQLServer Management Studio to a MS SQLServer.
It seems to work fine for one or two connections, but if more connections
are openend, boost suddenly crashes, mostly in the bind-template.hpp:

     template<class A1, class A2> result_type operator()(A1 const & a1, A2
const & a2)
     {
         list2<A1 const &, A2 const &> a(a1, a2);
CRASH ===> BOOST_BIND_RETURN l_(type<result_type>(), f_, a, 0);
     }

I have modified the code from the examples page:
http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/example/echo/async_tcp_echo_server.cpp

I only added a second socket in the session class for handling the
connection to the SQLServer.
When I start SSMS and click on "New query", I can see two additional
connections being opened, and then the program crashes.

I have posted the source code here:
session.h : http://pastebin.com/eC5fn7U8
session.cpp : http://pastebin.com/LDnQqCNr
server.h: http://pastebin.com/1fDJU6sx
server.cpp: http://pastebin.com/seMAVx4D
ProxyServer.cpp: http://pastebin.com/8S7YfE8L

Am I doing something wrong? Maybe the code isn't threadsafe? I'm new to
boost::asio and I might have missed an important point here.
Maybe I need more than one io_service object?

Andi

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net