Re: [ace-users] ACE_Reactor : The behaviour of "ACE_TP_Reactor" seemsto be different from the one described in TP_Reactor.h
87 views
Skip to first unread message
robert...@us.transport.bombardier.com
unread,
Sep 25, 2009, 12:29:47 PM9/25/09
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Steve Huston, ace-...@list.isis.vanderbilt.edu, ace-user...@list.isis.vanderbilt.edu
Oddly enough, though, this
might actually be executing the TP_Reactor properly. Since the TP_Reactors
are being submitted to the singleton ACE_Reactor::instance(), only the
very last TP_Reactor created is the actual underlying reactor implementation
bridged by the singleton ACE_Reactor. Since the various threads are
using the singleton ACE_Reactor, you really *do* have multiple threads
hitting the same TP_Reactor (just not the one that the first "n-1"
thread objects expect it to be).
I think the problem might
lie in the fact that handle_timeout is doing more "busy" work
than it should, especially in the failure cases. This isn't all that
bad with a TP_Reactor, though, since you can have one thread being very
busy inside handle_timeout() while the other threads are doing normal reactor
work.
But it could also be a problem
with the timer being scheduled as a periodic timer in the schedule_timer()
call. How many seconds is "polling_time"? If it's
shorter than the "failure" time (1 minute), then you might have
all of your reactor threads getting backed up trying to call handle_timeout()
on the one object that is "busy".
IF this were the issue, the
first thing I'd try is to change the initial "schedule" call
as follows:
long timer_id = ACE_Reactor::instance()->schedule_timer(PTimer,
pNull, polling_time); // <-- note: only "delay" is used,
no "interval"
Then in your handle_timeout(),
once you've done all of your processing, just reissue this command. In
this manner, at least your potentially blocking object is removed from
the reactor's timer queue until it reinserts itself at the end of handle_timeout.
- Bob
Please consider the environment before you print / Antes de imprimir, piense
en el medio ambiente
Re: [ace-users] ACE_Reactor : The behaviour
of "ACE_TP_Reactor" seemsto
be different from the one described in TP_Reactor.h
Hi Tony,
You've misunderstood how to use ACE_TP_Reactor. The intended use is
one ACE_TP_Reactor object whose run_reactor_event_loop() method is
called by multiple threads. You are creating one reactor instance for
each thread.
HOST MACHINE and OPERATING SYSTEM:
THEMIS, S.O. Solaris 9
TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
---
COMPILER NAME AND VERSION (AND PATCHLEVEL):
C++ compiler Sun Forte 7
CONTENTS OF $ACE_ROOT/ace/config.h:
#ifndef ACE_CONFIG_H
#include "ace/config-sunos5.8.h"
#endif
CONTENTS OF $ACE_ROOT/include/makeinclude/platform_macros.GNU
(unless
this isn't used in this case, e.g., with Microsoft Visual
C++):
----
AREA/CLASS/EXAMPLE AFFECTED:
ACE_Reactor
DOES THE PROBLEM AFFECT:
COMPILATION? NO
LINKING? NO
On Unix systems, did you run
make realclean first?
YES
EXECUTION? YES
OTHER (please specify)? NO
[Please indicate whether ACE, your application, or both are affected.]
ACE_Reactor doesn't respect the timer_queue, so my application doesn't
respect some requirements (related to the timers)
SYNOPSIS:
The behaviour of "ACE_TP_Reactor" seems to be different from
the one
described in TP_Reactor.h
DESCRIPTION:
My application uses many threads.
Some of them register a timer on the ACE_Reactor that is instanced
into a
Thread class (named from now on My_Reactor_Thr).
In this class (My_Reactor_Thr) one (and only) ACE_TP_Reactor is
instanced as
follows:
'constructor of the My_Reactor_Thr (That in the code is named ):
At last, in some threads I use the "schedule_timer" method in
order to
register a timer on ACE_Reactor as follows:
long timer_id =
ACE_Reactor::instance()->schedule_timer(PTimer,pNull,polling_time,poll
ing_time);
My application runs on a specific hardware and software platform.
Other applications run on other specific hardware and software
platform
connected with mine.
Particularly, there is a couple of consoles which software is
connected by
CORBA interface with my application.
My application monitors the states of the two consoles by polling them
once
a second (by the ACE_Reactor internal timers management).
Generally, the ACE_Reactor works well and all the timer respect the
schedule.
Sometimes consoles have problems and they work too slowly, causing a
trouble
to my application, described below:
- When the time for the polling has come, the My_Reactor_Thr calls the
opportune "handle_timeout" (containing the polling action working
on
CORBA
interface).
- Generally the polling action is completed in about 3 milliseconds,
but...
- ... When the console have problem the polling action is completed in
about
1 minute!!!
- In the meanwhile the threads different by My_Reactor_Thr of my
application, still work properly, but...
- ... the My_Reactor_Thr waites on CORBA interface the answer of the
console.
- So, although the timer for the next handle_timeout is arrived, the
My_Reactor_Thr is still waiting, not respecting the time schedule for
the
other timers.
- Once the polling action is complete, the My_Reactor_Thr goes on and
works
properly again, but a lot of action-timer are lost.
Since what is reported on "TP_Reactor.h":
"When an event occurs, the leader will pick a follower to become the
leader
and go on to handle the event".
And
"It works by remembering the event handler that just got activated,
releasing the internal lock (so that some other thread can start
waiting in
the event loop) and then dispatching the event handler outside the
context
of the Reactor lock.",
I thought that once the timer for polling was trigged ("When an event
occurs"), the My_Reactor_Thr shall "goes on to handle the event"
and
in the
meanwhile ACE_Reactor shall continue to manage the queque.
Instead, it seems that once the event occurs (the timer is triggered),
the
leader handles the event until it is ended but, in the meanwhile, none
of
the followers starts as new leader.
So, now I ask if:
- I have misunderstood the "TP_Reactor.h" or...
- There is something that can invalidate the correct behaviour (e.g. I
have
bad instanced the TP_Reactor) or...
- If you can give me some hint useful for my situation (e.g. use the
"run_reactor_loop" method in some different way or use some other
method to
let ACE_Reactor go ahead without waiting).
Hope to receive an answer as soon as possible, best regards
_______________________________________________________________________________________________________________
This e-mail communication (and any attachment/s) may contain confidential
or privileged information and is intended only for the individual(s) or
entity named above and to others who have been specifically authorized
to receive it. If you are not the intended recipient, please do not read,
copy, use or disclose the contents of this communication to others. Please
notify the sender that you have received this e-mail in error by reply
e-mail, and delete the e-mail subsequently. Please note that in order to
protect the security of our information systems an AntiSPAM solution is
in use and will browse through incoming emails.
Thank you.
_________________________________________________________________________________________________________________
Ce message (ainsi que le(s) fichier(s)), transmis par courriel, peut contenir
des renseignements confidentiels ou protégés et est destiné à l’usage
exclusif du destinataire ci-dessus. Toute autre personne est, par les présentes,
avisée qu’il est strictement interdit de le diffuser, le distribuer ou
le reproduire. Si vous l’avez reçu par inadvertance, veuillez nous en
aviser et détruire ce message. Veuillez prendre note qu'une solution antipollupostage
(AntiSPAM) est utilisée afin d'assurer la sécurité de nos systèmes d'information
et qu'elle furètera les courriels entrants.
Merci.
_________________________________________________________________________________________________________________