Server failing when BOOST_ASIO_ENABLE_HANDLER_TRACKING is active
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.
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.
I guess you've got an ODR violation, and this is the root of all the issues you encounter. Check thoroughly all the #ifdef's and #define's you have in every translation unit.
On 01/01/13 22:13, Gonzalo Garramuno wrote:
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.
I spoke too early. I removed all debugging code from asio and it does not crash anymore. Attached are the new logs, which show nothing in particular. Maybe someone can see something missing.
I have the same problem when defining BOOST_ASIO_ENABLE_HANDLER_TRACKING. My io_services are simply returning. like if there was no event to process. When I remove the define, it runs well. On Thursday, 3 January 2013 21:12:40 UTC, Gonzalo Garramuno wrote:
On 01/01/13 22:13, Gonzalo Garramuno wrote:
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.
I spoke too early. I removed all debugging code from asio and it does not crash anymore. Attached are the new logs, which show nothing in particular. Maybe someone can see something missing.
Ok, I think I got it! You have to define the BOOST_ASIO_ENABLE_HANDLER_TRACKING in every module that uses Boost. I was only defining in one and that may be the reason why io_service was returning (or crashing, don't know). What I know is that I defined BOOST_ASIO_ENABLE_HANDLER_TRACKING in all my modules and now I have tracking are proper program execution. Hope it helps! On Wednesday, 22 January 2014 14:07:45 UTC, Carlos Ferreira wrote:
I have the same problem when defining BOOST_ASIO_ENABLE_HANDLER_TRACKING. My io_services are simply returning. like if there was no event to process. When I remove the define, it runs well.
On Thursday, 3 January 2013 21:12:40 UTC, Gonzalo Garramuno wrote:
On 01/01/13 22:13, Gonzalo Garramuno wrote:
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.
I spoke too early. I removed all debugging code from asio and it does not crash anymore. Attached are the new logs, which show nothing in particular. Maybe someone can see something missing.
On Wed, Jan 22, 2014 at 12:18 PM, Carlos Ferreira
Ok, I think I got it! You have to define the BOOST_ASIO_ENABLE_HANDLER_TRACKING in every module that uses Boost. I was only defining in one and that may be the reason why io_service was returning (or crashing, don't know). What I know is that I defined BOOST_ASIO_ENABLE_HANDLER_TRACKING in all my modules and now I have tracking are proper program execution.
This is true for most macros that alter behavior. Because they usually modify the definition of inline and template functions, and multiple definitions of external linking functions with different definitions is an One Definition Rule violation.
Hope it helps!
Regards, -- Felipe Magno de Almeida
participants (4)
-
Carlos Ferreira
-
Felipe Magno de Almeida
-
Gonzalo Garramuno
-
Igor R