Discussion:
[asio-users] Server is exhibiting erratic behavior. I Got bitten by ODR - I think!?
Fries David (Helbling Technik)
2015-03-19 14:21:51 UTC
Permalink
Hello Everybody

I have an application which links against library A which in turn link against library B. Both libs were written by us. Library B was built with BOOST_ASIO_ENABLE_HANDLER_TRACKING defined, but library A wasn't. The resulting application is very unstable- crashing randomly, asserts failing, sometimes appearing to be running then crashing on shutdown, etc. We tried to debug the problem but the backtraces always pointed into Asio itself, not into our code. If I enable (or disable) handler tracking everywhere, things work like a charm.

Was I violating the one-definition-rule by using inconsistent debugging options in different libraries? Is this a reasonable assumption? I was aware of ODR when building a single binary or library, but I didn't expect that there would be issues across libraries...

I know that's not much information to go on, but I would like to hear your thoughts on this issue.

Dave
Fries David (Helbling Technik)
2015-03-19 17:45:44 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello Everybody

I have an application which links against library A which in turn link against library B. Both libs were written by us. Library B was built with BOOST_ASIO_ENABLE_HANDLER_TRACKING defined, but library A wasn’t. The resulting
application is very unstable– crashing randomly, asserts failing, sometimes appearing to be running then crashing on shutdown, etc. We tried to debug the problem but the backtraces always pointed into Asio itself, not into our code. If I enable (or disable)
handler tracking everywhere, things work like a charm.

Was I violating the one-definition-rule by using inconsistent debugging options in different libraries? Is this a reasonable assumption? I was aware of ODR when building a single binary or library, but I didn’t expect
that there would be issues across libraries…

I know that’s not much information to go on, but I would like to hear your thoughts on this issue.

Dave

P.S. Sorry about the double post. The Outlook decided it likes HTML Mail...


-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.2 (Build 15413)
Charset: Windows-1252

wsBVAwUBVQsLSt5vj2L2c9I5AQhUHwgApI59wpk0Xc/NoYB6OUYNZ4o5q9jX/rAD
vhfFcIW0kq130qVFxDsE5OUbr+93nVGA/ZQBjSB3l/7oLfkpNrL9G/j9/Tnpg+7R
JHgky+5oseU4kz3gRzek83WJj/tRZXp2nwWQyTo/DxO1Vm+ifse1OkiX1LiMXJjx
vbQd6iOamrzaY756f9IlSB8vrmy2tC+3Emt/l01RvPtcPlGMaanETtnd+l5K2zW8
8tzvFBjLXMPuU4KuMoeBRRyIuCOlrDbZlkX5ljfCRaopWwkPmVtomv+x0UNf19bA
KYg7uu4i5Lf7BhrQlbkWg743nlZ6gSQinoGanf8d7uqatKZeXjenhA==
=mDKd
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
Igor R
2015-03-19 19:38:05 UTC
Permalink
Post by Fries David (Helbling Technik)
I have an application which links against library A which in turn link
against library B. Both libs were written by us. Library B was built with
BOOST_ASIO_ENABLE_HANDLER_TRACKING defined, but library A wasn’t. The
resulting application is very unstable– crashing randomly, asserts failing,
sometimes appearing to be running then crashing on shutdown, etc. We tried
to debug the problem but the backtraces always pointed into Asio itself, not
into our code. If I enable (or disable) handler tracking everywhere, things
work like a charm.
Was I violating the one-definition-rule by using inconsistent debugging
options in different libraries? Is this a reasonable assumption? I was aware
of ODR when building a single binary or library, but I didn’t expect that
there would be issues across libraries…
The static libraries here are a kind of "red herring". What matters is
whether you compile one translation unit *with*
BOOST_ASIO_ENABLE_HANDLER_TRACKING and another one *without* that
macro. Certainly, some of the TUs may be a part of some static
library, it doesn't matter.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/
Fries David (Helbling Technik)
2015-03-23 10:31:36 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Post by Fries David (Helbling Technik)
I have an application which links against library A which in turn link
against library B. Both libs were written by us. Library B was built
with BOOST_ASIO_ENABLE_HANDLER_TRACKING defined, but library A wasn’t.
The resulting application is very unstable– crashing randomly, asserts
failing, sometimes appearing to be running then crashing on shutdown,
etc. We tried to debug the problem but the backtraces always pointed
into Asio itself, not into our code. If I enable (or disable) handler
tracking everywhere, things work like a charm.
Was I violating the one-definition-rule by using inconsistent
debugging options in different libraries? Is this a reasonable
assumption? I was aware of ODR when building a single binary or
library, but I didn’t expect that there would be issues across
libraries…
The static libraries here are a kind of "red herring". What matters is whether you compile one translation unit *with* BOOST_ASIO_ENABLE_HANDLER_TRACKING and another one *without* that macro. Certainly, some of the TUs may be a part of some static library, it doesn't matter.
Thanks for the reply. Actually we used shared libraries. I guess we didn't pay enough attention to the ABI.

-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.2 (Build 15413)
Charset: utf-8

wsBVAwUBVQ/rjd5vj2L2c9I5AQjAZAf+P+NplfHT1YpK4H+g/4eCzsflKULXKv49
itdu5JZ6qbnnf8hnOGuy4yIYTPerZ1Ypo+aynTLLq0MTm1/vU9AnbsGFP6ZLspMU
IwC3bRNH2hN4D6HrTXy8d8G9O4FOhL+NqBJVq16Tu53YS5MitsDYQa22uXmXd7jv
6+q4P3s4az/J80V9M9wrVyN6ZSqOHXavE43aUP6PsgbcG7Q11+C4GZpgPgxSW9x+
cfB6271SmJ4CusNpuKhRNbPWLCE+pFe9J0heil0o96MWBp8Y4DSMpQB1xzEUbA7v
WE1R3P0/iWO/+ET4IAwAe6jxy7A0w5Y5BXKBOTafKpeJpYvVScbz+A==
=JIsa
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-as

Loading...