Trying to track down when the socket closes on my program, I turned on asio debugging. Server fails when BOOST_ASIO_ENABLE_HANDLER_TRACKING is active. Its stack trace is: g Scanning dependencies of target mrViewer [ 9%] Building CXX object mrViewer/src/CMakeFiles/mrViewer.dir/core/mrvServer.o Linking CXX executable ../../../bin/mrViewer [100%] Built target mrViewer # gga@gga-laptop1 /media/Linux/code/applications/mrViewer # mar ene 01 10:04 [8] $ mrViewer /media/Linux/movies/Tangled.mov [opengl] Using hardware shader profile: NVidia NV30 [opengl] mrViewer supports YUV images through shaders. [psql] Connected to database 'assets2d_development'. The code: boost::asio::io_service io_service; tcp::endpoint listen_endpoint(tcp::v4(), s->port); server rp(io_service, listen_endpoint, s->ui); io_service.run(); fails with: @asio|1357088683.200673|0|socket@0x7f303d8d2d00.close Got signal 11, faulty address is 0x1, from 0x4d222a [bt] Execution path: [bt] mrViewer(_ZN5boost4asio6detail15task_io_service16shutdown_serviceEv+0x3a) [0x4d222a] [bt] mrViewer(_ZN5boost4asio6detail15task_io_service16shutdown_serviceEv+0x3a) [0x4d222a] [bt] mrViewer() [0x4dd2c9] [bt] mrViewer(_ZN3mrv13server_threadEPKNS_10ServerDataE+0x408) [0x4e0e58] [bt] /usr/lib/libboost_thread.so.1.48.0(+0xdda9) [0x7f304e191da9] [bt] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7e9a) [0x7f304f7f0e9a] [bt] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f304da1ccbd] without the #define the code works reliably except sometimes the socket closes unexpectedly.