summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-19 17:36:05 +0000
committercbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-19 17:36:05 +0000
commitafdde46ad84360164deaa75bce80c6ed2f232f42 (patch)
tree7546b7f5fda1401ec9995c3d14e99a9b45ee6083
parentcec172abb326be14f96ebf06a1ae48eee91c3e48 (diff)
downloadATCD-afdde46ad84360164deaa75bce80c6ed2f232f42.tar.gz
Mon Apr 19 17:34:04 UTC 2010 Chad Beaulac <chad@objectivesolutions.com
* ace/Service_Repository.cpp Modified ASR::fini to print debug info for empty service entries and handle empty service entries. This fixes the ASR remove functionality that was one of the reasons SC_Server was crashing at shutdown. * examples/ASX/CCM_App/SC_Server.cpp Removed ACE_Sig_Adapter shutdown_handler. Registered SIGINT and SIGQUIT handler for Event_Handler so it could call eh->remove_std_in_handler() to prevent SEGV at shutdown when CTRL-C was used to shutdown. This fixes Bugzilla #2916 and #3205. I'll create another patch for #3334 after this commit.
-rw-r--r--ChangeLog65
-rw-r--r--ace/Service_Repository.cpp84
-rw-r--r--examples/ASX/CCM_App/SC_Server.cpp36
3 files changed, 136 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index a8869ad342f..ca116aace05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,61 @@
-Mon Apr 19 14:43:39 UTC 2010 Chad Beaulac <chad@objectivesolutions.com>
+Mon Apr 19 17:34:04 UTC 2010 Chad Beaulac <chad@objectivesolutions.com
+
+ * ace/Service_Repository.cpp
+ Modified ASR::fini to print debug info for empty
+ service entries and handle empty service entries.
+ This fixes the ASR remove functionality that was
+ one of the reasons SC_Server was crashing at shutdown.
* examples/ASX/CCM_App/SC_Server.cpp
Removed ACE_Sig_Adapter shutdown_handler.
- This was causing a bus error at application termination.
- It is also unnecessary because the STDIN handler
- is taking care of shutdown upon a CTRL-C.
+ Registered SIGINT and SIGQUIT handler for Event_Handler
+ so it could call eh->remove_std_in_handler() to prevent
+ SEGV at shutdown when CTRL-C was used to shutdown.
+
+ This fixes Bugzilla #2916 and #3205.
+ I'll create another patch for #3334 after this commit.
+
+Mon Apr 19 12:44:56 UTC 2010 Chad Beaulac <chad@objectivesolutions.com>
+
+ * ace/Service_Types.h
+ * ace/Service_Types.inl
+ * ace/Service_Types.cpp
+ Added service_type_ attr to expose the type of service being
+ managed to the ACE_Service_Repository. This allows the ASR to
+ manage the lifecycle of the ACE_Module and ACE_Stream in order to
+ avoid a double delete of ACE_Module at shutdown.
+
+ ACE_Stream_Type::fini was modified to not call ACE_Module_Type::fini
+ as this will results in a double delete when ACE_Service_Repository::fini
+ is called. ACE_Stream_Type::remove(module_name) was modified to not call
+ ACE_Module_Type::fini as this will results in a double delete
+ when ACE_Service_Repository::fini is called also.
+
+ * ace/Service_Repository.cpp
+ Modified ASR::fini to iterate over the service_array_ twice.
+ ACE_Service_Type::fini is called on all ACE_Stream_Type and
+ ACE_Service_Object_Type instances first. Then, fini is called on
+ all ACE_Modules_Type instances. All calls to fini are done in the
+ order the services appear in the ASR::service_array_ except for
+ the grouping described here. The calls to ACE_Module_Type::fini
+ must be done last because ACE_Stream_Type::fini accesses the Modules
+ so they must not be deleted by a call to ACE_Module_Type::fini
+ before that.
+
+ * tests/Bug_3334_Regresssion_Test.cpp
+ Added call to ACE_Service_Repository::fini_svcs() to capture all
+ debug output before the application exits.
+
+ * tests/run_tests.lst
+ Removed !FIXED_BUGS_ONLY from Bug_3334_Regression_Test
+
+ This fixes Bugzilla #3334
+
+Mon Apr 19 06:54:01 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
- This fixes Bugzilla #2916 and #3205
+ * bin/MakeProjectCreator/config/global.features:
+ Enabled LightWeigth CCM as default, if you want to use the
+ full ccm features set ccm_lw to 0 in your default.features file
Fri Apr 16 13:02:04 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
@@ -14,9 +63,9 @@ Fri Apr 16 13:02:04 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* ace/Atomic_Op.inl:
* ace/Atomic_Op.cpp:
* ace/config-sunos5.10.h:
- Added support for the Solaris 10 Atomic support, thanks
- to Aleksandar Vukajlovic <aleksandar dot vukajlovic at finsoft dot rs>
- for providing the patches
+ Added support for the Solaris 10 Atomic support, thanks
+ to Aleksandar Vukajlovic <aleksandar dot vukajlovic at finsoft dot rs>
+ for providing the patches
Wed Apr 14 11:22:27 UTC 2010 Steve Huston <shuston@riverace.com>
diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp
index c04eeb372b6..d997c5e61cc 100644
--- a/ace/Service_Repository.cpp
+++ b/ace/Service_Repository.cpp
@@ -113,8 +113,9 @@ ACE_Service_Repository::ACE_Service_Repository (size_t size)
ACE_TRACE ("ACE_Service_Repository::ACE_Service_Repository");
}
-
+
/// Finalize (call fini() and possibly delete) all the services.
+
int
ACE_Service_Repository::fini (void)
{
@@ -125,71 +126,80 @@ ACE_Service_Repository::fini (void)
// Do not be tempted to use the prefix decrement operator. Use
// postfix decrement operator since the index is unsigned and may
// wrap around the 0
+ //
+ // debug output for empty service entries
+#ifndef ACE_NLOGGING
+ if (ACE::debug ())
+ {
+ for (size_t i = this->service_array_.size (); i-- != 0;)
+ {
+ ACE_Service_Type *s =
+ const_cast<ACE_Service_Type *> (this->service_array_[i]);
+ if (s == 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] -> 0\n"),
+ this,
+ i));
+ }
+ }
+#endif
+ //
+ // Remove all the Service_Object and Stream instances
+ //
for (size_t i = this->service_array_.size (); i-- != 0;)
{
// <fini> the services in reverse order.
ACE_Service_Type *s =
const_cast<ACE_Service_Type *> (this->service_array_[i]);
- if (s->type ()->service_type () != ACE_Service_Type::MODULE)
+ if (s != 0 && (s->type ()->service_type () != ACE_Service_Type::MODULE))
{
#ifndef ACE_NLOGGING
if (ACE::debug ())
{
- if (s != 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
- ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
- this,
- i,
- s->name (),
- s->type (),
- (s->type () != 0) ? s->type ()->object () : 0,
- s->active ()));
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] -> 0\n"),
- this,
- i));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
+ ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
+ this,
+ i,
+ s->name (),
+ s->type (),
+ (s->type () != 0) ? s->type ()->object () : 0,
+ s->active ()));
}
#endif
// Collect any errors.
- if (s != 0)
- retval += s->fini ();
+ retval += s->fini ();
}
}
+ //
+ // Remove all the Module instances
+ //
for (size_t i = this->service_array_.size (); i-- != 0;)
{
// <fini> the services in reverse order.
ACE_Service_Type *s =
const_cast<ACE_Service_Type *> (this->service_array_[i]);
- if (s->type ()->service_type () == ACE_Service_Type::MODULE)
+ if (s != 0 && (s->type ()->service_type () == ACE_Service_Type::MODULE))
{
#ifndef ACE_NLOGGING
if (ACE::debug ())
{
- if (s != 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
- ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
- this,
- i,
- s->name (),
- s->type (),
- (s->type () != 0) ? s->type ()->object () : 0,
- s->active ()));
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d] -> 0\n"),
- this,
- i));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("ACE (%P|%t) SR::fini, repo=%@ [%d], ")
+ ACE_TEXT ("name=%s, type=%@, object=%@, active=%d\n"),
+ this,
+ i,
+ s->name (),
+ s->type (),
+ (s->type () != 0) ? s->type ()->object () : 0,
+ s->active ()));
}
#endif
// Collect any errors.
- if (s != 0)
- retval += s->fini ();
+ retval += s->fini ();
}
}
return (retval == 0) ? 0 : -1;
diff --git a/examples/ASX/CCM_App/SC_Server.cpp b/examples/ASX/CCM_App/SC_Server.cpp
index c2e644fe2b4..0199451fdd3 100644
--- a/examples/ASX/CCM_App/SC_Server.cpp
+++ b/examples/ASX/CCM_App/SC_Server.cpp
@@ -10,7 +10,7 @@
#include "ace/Reactor.h"
#include "ace/Sig_Adapter.h"
-ACE_RCSID(CCM_App, SC_Server, "$Id$")
+ACE_RCSID (CCM_App, SC_Server, "$Id$")
class Event_Handler : public ACE_Event_Handler
{
@@ -18,8 +18,26 @@ public:
virtual int handle_input (ACE_HANDLE handle);
virtual int handle_close (ACE_HANDLE,
ACE_Reactor_Mask);
+
+ virtual int handle_signal (int signum,
+ siginfo_t *,
+ ucontext_t *);
};
+
+// @@ Note that this code is not portable to all OS platforms since
+// it does print statements within the signal handler.
+
+int
+Event_Handler::handle_signal (int signum,
+ siginfo_t *,
+ ucontext_t *)
+{
+ if (signum == SIGINT || signum == SIGQUIT)
+ return -1;
+ return 0;
+}
+
int
Event_Handler::handle_input (ACE_HANDLE handle)
{
@@ -35,7 +53,7 @@ Event_Handler::handle_input (ACE_HANDLE handle)
else if (ACE_OS::write (ACE_STDOUT, buf, n) != n)
ACE_ERROR_RETURN ((LM_DEBUG,
ACE_TEXT ("%p\n"), ACE_TEXT ("write failed")),
- -1);
+ -1);
else
return 0;
}
@@ -45,6 +63,8 @@ Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("closing Event_Handler\n")));
+ //ACE_Reactor::instance ()->remove_handler (this,ACE_Event_Handler::ALL_EVENTS_MASK);
+ this->remove_stdin_handler (ACE_Reactor::instance (),ACE_Thread_Manager::instance ());
ACE_Reactor::instance ()->end_reactor_event_loop ();
return 0;
}
@@ -71,8 +91,16 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
ACE_TEXT ("%p\n%a"),
ACE_TEXT ("open"),
1));
- // Perform logging service until we receive SIGINT.
+ else
+ {
+ ACE_Reactor::instance ()->register_handler (SIGQUIT, &handler);
+ ACE_Reactor::instance ()->register_handler (SIGINT, &handler);
+ ACE_Reactor::instance ()->run_reactor_event_loop ();
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("SC_Server exiting\n")));
- ACE_Reactor::instance ()->run_reactor_event_loop ();
+ loggerd.fini_svcs ();
+ }
return 0;
}