Commit da25c4d7 authored by Marcin Siodelski's avatar Marcin Siodelski

[4009] Fixed the deinitialization of objects in the Memfile unit test.

parent 5bd46ab9
......@@ -134,6 +134,21 @@ public:
/// destroys lease manager backend.
virtual ~MemfileLeaseMgrTest() {
// Explicitly destroy the timer and the IO service. Note that they
// must be destroyed in this order because test_timer_ depends on
// the io_service_ as it is passed its reference during the
// construction. It usually doesn't matter unless the timer is
// running (hasn't been cancelled). Destroying an underlying
// IO service before cancelling the timer relying on it may lead
// to a crash. This has been proven on CentOS 6, running boost
// version 1.41. Note that destroying the timer also cancels it.
// In theory, we could avoid this explicit release of these objects
// and rely on the order in which they are declared in the class.
// But, this seems to be better as it makes it more visible
// what we are doing here.
// Remove lease files and products of Lease File Cleanup.
......@@ -243,12 +258,12 @@ public:
/// @brief Object providing access to v6 lease IO.
LeaseFileIO io6_;
/// @brief Test timer for the test.
boost::shared_ptr<IntervalTimer> test_timer_;
/// @brief IO service object used for the timer tests.
asiolink::IOServicePtr io_service_;
/// @brief Test timer for the test.
boost::shared_ptr<IntervalTimer> test_timer_;
/// @brief Indicates if the @c testTimerCallback should cause test failure.
bool fail_on_callback_;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment