Boost C++ Libraries: Ticket #5339: asio async_read throws boost::asio::error::invalid_argument on mac OS X https://svn.boost.org/trac10/ticket/5339 <p> I am trying to write a serial library using Boost's asio, but on mac OS X the async_read throws boost::asio::error::invalid_argument. I have created a custom completion condition to ignore the invalid_argument exceptions, but this causes a busy wait (using a lot of cpu time) yet does not prevent data from being read. </p> <p> I have attached source code and output from both linux and os x. </p> <p> Linux: Ubuntu 10.10 i386 - Boost 1.42.0 Mac OS X: 10.6.6 - Boost 1.45.0 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5339 Trac 1.4.3 wjwwood@… Sat, 19 Mar 2011 00:06:17 GMT attachment set https://svn.boost.org/trac10/ticket/5339 https://svn.boost.org/trac10/ticket/5339 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">serial.cpp</span> </li> </ul> Ticket wjwwood@… Sat, 19 Mar 2011 00:06:44 GMT attachment set https://svn.boost.org/trac10/ticket/5339 https://svn.boost.org/trac10/ticket/5339 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">serial.h</span> </li> </ul> Ticket wjwwood@… Sat, 19 Mar 2011 00:08:11 GMT attachment set https://svn.boost.org/trac10/ticket/5339 https://svn.boost.org/trac10/ticket/5339 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_serial.cpp</span> </li> </ul> Ticket wjwwood@… Sat, 19 Mar 2011 00:16:49 GMT attachment set https://svn.boost.org/trac10/ticket/5339 https://svn.boost.org/trac10/ticket/5339 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">osx.transcript</span> </li> </ul> Ticket wjwwood@… Sat, 19 Mar 2011 00:17:40 GMT attachment set https://svn.boost.org/trac10/ticket/5339 https://svn.boost.org/trac10/ticket/5339 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">linux.transcript</span> </li> </ul> Ticket anonymous Sat, 19 Mar 2011 00:21:50 GMT <link>https://svn.boost.org/trac10/ticket/5339#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:1</guid> <description> <p> Just a bit more info... </p> <p> The Linux transcript is the expected behavior. The characters are coming into the serial port at 1Hz (Arduino microcontroller) and the timeout is set to 250 milliseconds, so there should be three time outs to every read with data. </p> <p> The problem seems to allow data to be read on os x, but it prevents serial_port.cancel from working properly and therefore keeping my deadline_timer based timeout from working properly. </p> <p> The serial.h and serial.cpp should compile with just Boost, but the test_serial.cpp uses ROS (ros.org), but the example is simple enough to reproduce with out quickly. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sat, 19 Mar 2011 04:46:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:2</guid> <description> <p> Try adding <code>-DBOOST_ASIO_DISABLE_KQUEUE</code> to your compiler command line to disable kqueue. </p> <p> Apparently, character devices residing on an HFS partition are incompatible with kqueue. See <a class="ext-link" href="http://communities.vmware.com/message/964276"><span class="icon">​</span>this forum post</a> for example. </p> <p> Please consider raising a bug with Apple if this is important to you. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 19 Mar 2011 17:22:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:3</guid> <description> <p> Thanks this seems to allow expected behavior in OS X. I had two follow up questions though. </p> <ol><li>Does disabling kqueue for a select based implementation have many if any drawbacks? (Is this documented somewhere?) </li><li>Would you advise define'ing the BOOST_ASIO_DISABLE_KQUEUE in the compiler arguments or in the source code? </li></ol><p> Sorry if these seems like easy questions, I am still a bit new to c++ and boost. </p> <p> Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Sun, 20 Mar 2011 00:08:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/5339#comment:3" title="Comment 3">anonymous</a>: </p> <blockquote class="citation"> <ol><li>Does disabling kqueue for a select based implementation have many if any drawbacks? (Is this documented somewhere?) </li></ol></blockquote> <p> If you use select then "the number of file descriptors in the process cannot be permitted to exceed FD_SETSIZE". This defaults to 1024 on Mac OS X. </p> <p> (From <a href="http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/overview/implementation.html">http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/overview/implementation.html</a>) </p> <blockquote class="citation"> <ol start="2"><li>Would you advise define'ing the BOOST_ASIO_DISABLE_KQUEUE in the compiler arguments or in the source code? </li></ol></blockquote> <p> You should prefer the compiler command line for these sorts of options. It helps ensure the option is consistent across your whole program. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 05 May 2011 17:06:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:5</guid> <description> <p> Could you add a note about this to the Mac OS X platform-specific implementation notes? This is the first place I looked when this bit me. I wouldn't have wasted a bunch of time on it if it were already documented. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Pharmb679</dc:creator> <pubDate>Mon, 12 Nov 2012 21:15:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:6</guid> <description> <blockquote> <p> Hello! ggacbad interesting ggacbad site! I'm really like it! Very, very ggacbad good! </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Pharmd821</dc:creator> <pubDate>Mon, 12 Nov 2012 21:16:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:7</guid> <description> <blockquote> <p> Hello! cfdeeef interesting cfdeeef site! I'm really like it! Very, very cfdeeef good! </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Pharmc743</dc:creator> <pubDate>Sat, 24 Nov 2012 07:30:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:8</guid> <description> <blockquote> <p> Hello! gddfbdd interesting gddfbdd site! I'm really like it! Very, very gddfbdd good! </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>Pharme273</dc:creator> <pubDate>Sat, 24 Nov 2012 07:31:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5339#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5339#comment:9</guid> <description> <blockquote> <p> Hello! kbbaeea interesting kbbaeea site! I'm really like it! Very, very kbbaeea good! </p> </blockquote> </description> <category>Ticket</category> </item> </channel> </rss>