Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
3b44fa23
Commit
3b44fa23
authored
Jun 08, 2015
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Heap-use-after-free with hidden actors
parent
e1c9577a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
13 deletions
+8
-13
libcaf_core/src/actor_registry.cpp
libcaf_core/src/actor_registry.cpp
+0
-3
libcaf_core/src/local_actor.cpp
libcaf_core/src/local_actor.cpp
+2
-7
libcaf_core/src/singletons.cpp
libcaf_core/src/singletons.cpp
+6
-3
No files found.
libcaf_core/src/actor_registry.cpp
View file @
3b44fa23
...
@@ -122,9 +122,6 @@ void actor_registry::await_running_count_equal(size_t expected) {
...
@@ -122,9 +122,6 @@ void actor_registry::await_running_count_equal(size_t expected) {
CAF_LOG_DEBUG
(
"count = "
<<
m_running
.
load
());
CAF_LOG_DEBUG
(
"count = "
<<
m_running
.
load
());
m_running_cv
.
wait
(
guard
);
m_running_cv
.
wait
(
guard
);
}
}
// also wait for all detached threads to make sure
// destructore were called correctly
scheduler
::
await_detached_threads
();
}
}
}
// namespace detail
}
// namespace detail
...
...
libcaf_core/src/local_actor.cpp
View file @
3b44fa23
...
@@ -478,10 +478,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
...
@@ -478,10 +478,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
// actor lives in its own thread
// actor lives in its own thread
CAF_PUSH_AID
(
id
());
CAF_PUSH_AID
(
id
());
CAF_LOG_TRACE
(
CAF_ARG
(
lazy
)
<<
", "
<<
CAF_ARG
(
hide
));
CAF_LOG_TRACE
(
CAF_ARG
(
lazy
)
<<
", "
<<
CAF_ARG
(
hide
));
if
(
!
hide
)
{
// hiding the actor also hides the thread
scheduler
::
inc_detached_threads
();
scheduler
::
inc_detached_threads
();
}
//intrusive_ptr<local_actor> mself{this};
//intrusive_ptr<local_actor> mself{this};
std
::
thread
{[
hide
](
intrusive_ptr
<
local_actor
>
mself
)
{
std
::
thread
{[
hide
](
intrusive_ptr
<
local_actor
>
mself
)
{
// this extra scope makes sure that the trace logger is
// this extra scope makes sure that the trace logger is
...
@@ -497,9 +494,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
...
@@ -497,9 +494,7 @@ void local_actor::launch(execution_unit* eu, bool lazy, bool hide) {
}
}
mself
.
reset
();
mself
.
reset
();
}
}
if
(
!
hide
)
{
scheduler
::
dec_detached_threads
();
scheduler
::
dec_detached_threads
();
}
},
intrusive_ptr
<
local_actor
>
{
this
}}.
detach
();
},
intrusive_ptr
<
local_actor
>
{
this
}}.
detach
();
return
;
return
;
}
}
...
...
libcaf_core/src/singletons.cpp
View file @
3b44fa23
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "caf/message.hpp"
#include "caf/message.hpp"
#include "caf/exception.hpp"
#include "caf/exception.hpp"
#include "caf/scheduler.hpp"
#include "caf/local_actor.hpp"
#include "caf/local_actor.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
...
@@ -77,6 +78,8 @@ void singletons::stop_singletons() {
...
@@ -77,6 +78,8 @@ void singletons::stop_singletons() {
stop
(
s_group_manager
);
stop
(
s_group_manager
);
CAF_LOGF_DEBUG
(
"stop scheduler"
);
CAF_LOGF_DEBUG
(
"stop scheduler"
);
stop
(
s_scheduling_coordinator
);
stop
(
s_scheduling_coordinator
);
CAF_LOGF_DEBUG
(
"wait for all detached threads"
);
scheduler
::
await_detached_threads
();
CAF_LOGF_DEBUG
(
"stop actor registry"
);
CAF_LOGF_DEBUG
(
"stop actor registry"
);
stop
(
s_actor_registry
);
stop
(
s_actor_registry
);
// dispose singletons, i.e., release memory
// dispose singletons, i.e., release memory
...
@@ -91,13 +94,13 @@ void singletons::stop_singletons() {
...
@@ -91,13 +94,13 @@ void singletons::stop_singletons() {
CAF_LOGF_DEBUG
(
"dispose registry"
);
CAF_LOGF_DEBUG
(
"dispose registry"
);
dispose
(
s_actor_registry
);
dispose
(
s_actor_registry
);
// final steps
// final steps
CAF_LOGF_DEBUG
(
"stop and dispose logger, bye"
);
stop
(
s_logger
);
dispose
(
s_logger
);
stop
(
s_uniform_type_info_map
);
stop
(
s_uniform_type_info_map
);
dispose
(
s_uniform_type_info_map
);
dispose
(
s_uniform_type_info_map
);
stop
(
s_node_id
);
stop
(
s_node_id
);
dispose
(
s_node_id
);
dispose
(
s_node_id
);
CAF_LOGF_DEBUG
(
"stop and dispose logger, bye"
);
stop
(
s_logger
);
dispose
(
s_logger
);
}
}
actor_registry
*
singletons
::
get_actor_registry
()
{
actor_registry
*
singletons
::
get_actor_registry
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment