Re: [Boost-bugs] [Boost C++ Libraries] #3605: Boost.Asio: Static Initialization causes Deadlock during WSAStartup and other problems

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3605: Boost.Asio: Static Initialization causes Deadlock during WSAStartup and other problems
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-30 11:58:14


#3605: Boost.Asio: Static Initialization causes Deadlock during WSAStartup and
other problems
---------------------------------------+------------------------------------
  Reporter: ulrich.kroemer@… | Owner: chris_kohlhoff
      Type: Bugs | Status: reopened
 Milestone: Boost 1.41.0 | Component: asio
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords: deadlock asio WSAStartup
---------------------------------------+------------------------------------

Comment (by Fedor Trushkin <ted-xp@…>):

 I happened to encounter this particular issue today. I was surprised that
 it has been registered several years ago already.

 Here are my reasons why this should be considered as a critical issue:
  - as noticed kindly by '''jlcastillo''' current library code simply
 contradicts MSDN documentation;
  - the deadlock under discussion being rarely reproducable has all chances
 to leak to production;
  - the workaround you proposed is error-prone. Having just a single CPP
 file with directly included asio libraries will make the whole application
 buggy;
  - WinSock initialization will be performed before any consious user
 actions. Actually, you don't have even to create any of asio-related
 classes. Just include winsock_init.hpp to any of your cpp files;
  - winsock initialization will be called multiple times: once for every
 cpp file including winsock_init.hpp. It's not an error, but looks untidy.

 I would suggest the following:
  - remove static winsock_init_instance from headers;
  - leave its instances as private member of io_service;
  - require that asio library initialization should be performed before
 using its classes.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3605#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC