- remove Props.randomName and associated logic
- ActorRefFactory contains AtomicLong which is used to generate unique
children names
- base64-like encoding is used with reverse “digit” order
- disallow given names which are null, empty or start with ‘$’
- random names start have ‘$’ prepended (‘$’ not being one of the 64
characters)
- special marker “$_” for tempPath until “/tmp” supervisor is introduced
- TestActorRef uses globally unique “$$” prefix, as it creates actors
beneath any supervisor as instructed by the user
Calling ActorRef.stop() schedules a Terminate() system message. I
changed the effect of this message by splitting the
systemInvoke.terminate() method into two parts:
- in the old place only cancel receiveTimeout and .stop() all children
plus set 'stopping' flag
- in handleChildTerminated if children are empty while stopping==true
call doTerminate(), which detaches from dispatcher and does all the
usual cleanup
- if no children were there, this happens directly from terminate()
- while 'stopping', process only ChildTerminated() and Terminate(),
ignore Terminated() and dump all the rest to app.deadLetterMailbox
- to make this less convoluted move AutoReceiveMessage handling from
Actor to ActorCell (including become/unbecome), which was all
accessing ActorContext anyway
- teach TestEventListener that DeadLetters with Terminate()/Terminated()
are not that bad
There is no retry of the .stop(), yet, but that can easily be added now
in each Actor which shuts something down: simply watch the target, if no
Terminated() is received retry. It is not 100% reliable, though, if only
the ChildTerminated() was lost, because that will not be regenerated by
the deadLetterMailbox ... need to think about that one.
All tests green on my machine.
- LoggingBus.startDefaultLoggers would not wait for their
initialization, leading to non-reception of Mute messages at the very
start of test, which would in turn fail those test which require a
number of occurrences.
- fix that by having each logger respond to InitializeLogger(bus) as
soon as subscriptions are done (max 3 seconds, else Warning)
- make akka.actor.simpleName not use String.replaceAll (performance
oversight on my part)
- rename MainBusSpec object to EventStreamSpec
- give loggers nicer names: "log<id>-<classname>"
- automatic timeout was previously used for allowing clean shutdown, but
that does not work anymore anyway, must call ActorSystem.stop()
- that will also stop testActor, so no need for special treatment
- the automatic stop caused various eerie problems in different places,
because on Jenkins some sleep periods were longer, leading to such
timeout, which combined with the non-logging of dead letters made it
seem worse than it was
- the same information is transmitted as sender, hence enabling
ChildTerminated to become a singleton
- make lastSender accessible in TestKit (needed now for DeathWatchSpec)
- fix nasty infinite loop when logging at the wrong moment during
shutdown
(since I know now what’s causing these Jenkins failures ;-) )
- include recipient in DeadLetter
- include recipient in calls to enqueue/systemEnqueue
- move DeadLetterMailbox to ActorSystem (saves some space, too)
- hook up DeadLetterMailbox so it sends DeadLetters to app.deadLetters,
which publishes them on the eventStream
- subscribe TestEventListener to DeadLetter and turn it into Warning
The generated warnings about ChildTerminated are very much correct, they
remind us that we still need to fix supervisor.stop() to await all
children’s death before actually committing suicide.
(don't get your hopes up just yet: ActorPoolSpec still failing)
The issue was that during the LocalActorRef constructor 'this' was
published via the ActorCell's start method. The JMM's visibility
guarantee for final fields is only valid after the constructor returned,
thus I introduced a store-load barrier before calling ActorCell.start by
making actorCell a @volatile var (not sure what @volatile val means).
That way every user of the ActorRef reads the volatile field before
anything else, ensuring proper publication of the whole
LocalActorRef/ActorCell conglomerate (where the latter has quite a lot
of non-final fields).
- apply EventFilters so that at least on my machine no expected messages
are printed
- add new test config settings to akka-reference.conf
- set default for loglevel to WARNING
- print out timeout values in case of various timeouts if they occur
- enqueuing system messages to DeadLetterMailbox was broken in
principle, but not in practice for the current default deadLetter
implementation
- add assert that system messages are not enqueued multiple times
- *BusSpec was using incorrect compareSubscribers based on
identityHashCode, so moved the proper solution out of
BalancingDispatcher and into akka.util.Helpers and reuse that in all
places
- introduce Duration.Undefined and use that to initialize TestKit.end
(also use in places which abused Duration.MinusInf for similar
purposes)
- TestKit.remaining now returns AkkaConfig.SingleExpectDefaultTimeout if
end == Duration.Undefined
This will hopefully catch most of the cases where Jenkins previously
aborted the build after 60min.
- I suspect that this caused some of the recent timeouts, because that
got implicitly disabled by my moving TestTimeFactor into AkkaConfig
- special-cased since the full solution of making everything overridable
is being worked out by Havoc