Boost C++ Libraries: Ticket #4971: stream_descriptor not remove descriptor from epoll_reactor https://svn.boost.org/trac10/ticket/4971 <pre class="wiki">#include &lt;iostream&gt; #include &lt;unistd.h&gt; #include &lt;boost/asio.hpp&gt; #include &lt;boost/asio/posix/stream_descriptor.hpp&gt; int main() { boost::asio::io_service io_srv; { int cfd = ::dup(STDOUT_FILENO); std::cout &lt;&lt; "fd=" &lt;&lt; cfd &lt;&lt; std::endl &lt;&lt; std::flush; boost::asio::posix::stream_descriptor sd(io_srv, cfd); sd.cancel(); sd.close(); } { int cfd = ::dup(STDOUT_FILENO); std::cout &lt;&lt; "fd=" &lt;&lt; cfd &lt;&lt; std::endl &lt;&lt; std::flush; boost::asio::posix::stream_descriptor sd(io_srv, cfd); sd.cancel(); sd.close(); } } </pre><p> this code nice work on Fedora Core 5 / boost-1.44.0 (used select_reactor), but on Fedora 14 (epoll_reactor) boost- 1.44.0, 1.45.0 and TRUNK failed: </p> <pre class="wiki">$ ./a.out fd=3 fd=3 terminate called after throwing an instance of 'boost::exception_detail::clone_impl&lt;boost::exception_detail::error_info_injector&lt;boost::system::system_error&gt; &gt;' what(): File exists ... (core dumped) </pre><p> error thrown from constructor stream_descriptor, when boost try add descriptor inside epoll_reactor by calling epoll_ctl and receive error EEXIST </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4971 Trac 1.4.3 prabhu.swain@… Mon, 13 Dec 2010 10:02:38 GMT cc set https://svn.boost.org/trac10/ticket/4971#comment:1 https://svn.boost.org/trac10/ticket/4971#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">prabhu.swain@…</span> added </li> </ul> Ticket APinaev@… Wed, 12 Jan 2011 13:04:34 GMT attachment set https://svn.boost.org/trac10/ticket/4971 https://svn.boost.org/trac10/ticket/4971 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fix_boost.diff</span> </li> </ul> <p> if use force remove descriptor from epoll descriptors, then bug disappear </p> Ticket chris_kohlhoff Wed, 23 Feb 2011 01:06:36 GMT <link>https://svn.boost.org/trac10/ticket/4971#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4971#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/69194" title="Changes for asio version 1.5.0: * Added support for timeouts on ...">[69194]</a>) Changes for asio version 1.5.0: </p> <ul><li>Added support for timeouts on socket iostreams, such as ip::tcp::iostream. A timeout is set by calling expires_at() or expires_from_now() to establish a deadline. Any socket operations which occur past the deadline will put the iostream into a bad state. </li></ul><ul><li>Added a new error() member function to socket iostreams, for retrieving the error code from the most recent system call. </li></ul><ul><li>Added a new basic_deadline_timer::cancel_one() function. This function lets you cancel a single waiting handler on a timer. Handlers are cancelled in FIFO order. </li></ul><ul><li>Added a new transfer_exactly() completion condition. This can be used to send or receive a specified number of bytes even if the total size of the buffer (or buffer sequence) is larger. </li></ul><ul><li>Added new free functions connect() and async_connect(). These operations try each endpoint in a list until the socket is successfully connected. </li></ul><ul><li>Extended the buffer_size() function so that it works for buffer sequences in addition to individual buffers. </li></ul><ul><li>Added a new buffer_copy() function that can be used to copy the raw bytes between individual buffers and buffer sequences. </li></ul><ul><li>Added new non-throwing overloads of read(), read_at(), write() and write_at() that do not require a completion condition. </li></ul><ul><li>Added friendlier compiler errors for when a completion handler does not meet the necessary type requirements. When C++0x is available (currently supported for g++ 4.5 or later, and MSVC 10), static_assert is also used to generate an informative error message. Checking may be disabled by defining BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS. </li></ul><ul><li>Made the is_loopback(), is_unspecified() and is_multicast() functions consistently available across the ip::address, ip::address_v4 and ip::address_v6 classes. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3939" title="#3939: Feature Requests: Determination on wither ip::address is a multicast address (closed: fixed)">#3939</a>. </li></ul><ul><li>Added new non_blocking() functions for managing the non-blocking behaviour of a socket or descriptor. The io_control() commands named non_blocking_io are now deprecated in favour of these new functions. </li></ul><ul><li>Added new native_non_blocking() functions for managing the non-blocking mode of the underlying socket or descriptor. These functions are intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The functions have no effect on the behaviour of the synchronous operations of the socket or descriptor. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3307" title="#3307: Bugs: Stream descriptor blocking state set on close (closed: fixed)">#3307</a>. </li></ul><ul><li>Added the io_control() member function for socket acceptors. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3297" title="#3297: Bugs: io_control not exposed on tcp::connector in asio (closed: fixed)">#3297</a>. </li></ul><ul><li>For consistency with the C++0x standard library, deprecated the native_type typedefs in favour of native_handle_type, and the native() member functions in favour of native_handle(). </li></ul><ul><li>Added a release() member function to posix descriptors. This function releases ownership of the underlying native descriptor to the caller. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3900" title="#3900: Feature Requests: Request for support of &#34;release&#34; member function or assign without ... (closed: fixed)">#3900</a>. </li></ul><ul><li>Added support for sequenced packet sockets (SOCK_SEQPACKET). </li></ul><ul><li>Added a new io_service::stopped() function that can be used to determine whether the io_service has stopped (i.e. a reset() call is needed prior to any further calls to run(), run_one(), poll() or poll_one()). </li></ul><ul><li>Reduced the copying of handler function objects. </li></ul><ul><li>Added support for C++0x move construction to further reduce copying of handler objects. Move support is enabled when compiling in -std=c++0x mode on g++ 4.5 or higher, or when using MSVC10. </li></ul><ul><li>Removed the dependency on OS-provided macros for the well-known IPv4 and IPv6 addresses. This should eliminate the annoying "missing braces around initializer" warnings. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3741" title="#3741: Bugs: asio::ip::address_v6.hpp: Missing braces around anonymous union (closed: fixed)">#3741</a>. </li></ul><ul><li>Reduced the size of ip::basic_endpoint&lt;&gt; objects (such as ip::tcp::endpoint and ip::udp::endpoint). </li></ul><ul><li>Changed the reactor backends to assume that any descriptors or sockets added using assign() may have been dup()-ed, and so require explicit deregistration from the reactor. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4971" title="#4971: Bugs: stream_descriptor not remove descriptor from epoll_reactor (closed: fixed)">#4971</a>. </li></ul><ul><li>Changed the SSL error category to return error strings from the OpenSSL library. </li></ul><ul><li>Changed the separate compilation support such that, to use Asio's SSL capabilities, you should also include 'asio/ssl/impl/src.hpp in one source file in your program. </li></ul><ul><li>Removed the deprecated member functions named io_service(). The get_io_service() member functions should be used instead. </li></ul><ul><li>Removed the deprecated typedefs resolver_query and resolver_iterator from the ip::tcp, ip::udp and ip::icmp classes. </li></ul><ul><li>Fixed a compile error on some versions of g++ due to anonymous enums. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4883" title="#4883: Patches: epoll_reactor.hpp doesn`t compile with some versions of gcc (closed: fixed)">#4883</a>. </li></ul><ul><li>Added an explicit cast to the FIONBIO constant to int to suppress a compiler warning on some platforms. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5128" title="#5128: Bugs: Implicit constant overflow in non_blocking_io::name() (closed: fixed)">#5128</a>. </li></ul><ul><li>Fixed warnings reported by g++'s -Wshadow compiler option. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3905" title="#3905: Bugs: asio boost headers fail with g++-4.3.2 and -Wshadow -Werror (closed: fixed)">#3905</a>. </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Mon, 06 Jun 2011 01:47:14 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4971#comment:3 https://svn.boost.org/trac10/ticket/4971#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Applied to release branch in <a class="changeset" href="https://svn.boost.org/trac10/changeset/72428" title="Merge asio from trunk.">[72428]</a>. </p> Ticket anonymous Mon, 27 Feb 2017 14:15:59 GMT <link>https://svn.boost.org/trac10/ticket/4971#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4971#comment:4</guid> <description> <p> thx </p> </description> <category>Ticket</category> </item> </channel> </rss>