Hi,
I have a subclass of an UntypedActor that I use a Future to access. It works for hundreds of accesses then on the same nth message stalls at the same line in a method inside the Actor each time. I get the following stack trace, not an exception
Thread [actor-system-akka.actor.default-dispatcher-2] (Suspended)
ActorCell.invoke(Envelope) line: 490
Dispatcher$$anon$1(Mailbox).processMailbox(int, long) line: 238
Dispatcher$$anon$1(Mailbox).run() line: 220
ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec() line: 397
ForkJoinExecutorConfigurator$AkkaForkJoinTask(ForkJoinTask<V>).doExec() line: 260
ForkJoinPool$WorkQueue.runTask(ForkJoinTask<?>) line: 1339
ForkJoinExecutorConfigurator$AkkaForkJoinPool(ForkJoinPool).runWorker(ForkJoinPool$WorkQueue) line: 1979
MonitorableThreadFactory$AkkaForkJoinWorkerThread(ForkJoinWorkerThread).run() line: 107
The relevant parts of the code are
...
private HashMap<Integer, List<String>> PA72UIds = new HashMap<Integer, List<String>>();
...
...
private UIdUsed getUIds(UIdsRequired msg) {
UIdUsed result = new UIdUsed();
if (msg.getMpeBuild().getSource() == SOURCE.OMC) {
result.setuIds24(populateUIds(msg, PA24UIds, 1, OMCLookback));
result.setuIds48(populateUIds(msg, PA48UIds, 2, OMCLookback));
result.setuIds72(populateUIds(msg, PA72UIds, 3, OMCLookback)); //2
...
...
private List<String> populateUIds(UIdsRequired msg,
HashMap<Integer, List<String>> idHolder, int range, int lookback) {
int numReq = msg.getNumRequired();
// We split the MPEr across the 5 scan sources equally then in
// proportion to product duration type
numReq = numReq/5;
List<String> avail = null;
List<String> remaining = null;
ArrayList<String> availUIds = new ArrayList<String>(0);
int i = 0;
while (availUIds.size() < numReq) {
// Look one slot closer, after i increments > 0
int lookbackSlot = msg.getMpeBuild().getSlot() - lookback + i;
if (lookbackSlot >= 0) {
avail = idHolder.get(lookbackSlot);
if (avail != null && avail.size() >= numReq) { //3
...
...
@Override
public void onReceive(Object msg) throws Exception {
if (msg instanceof UIdUsed) {
addToStore((UIdUsed) msg);
} else if (msg instanceof UIdsRequired) {
UIdUsed ids = getUIds((UIdsRequired) msg); //1
...
The call count of the Actor is 55 each time when the avail variable causes this issue. You can see in the comments I added //1 calls getUIds, in getUIds //2 calls populateUIds, the previous 2 calls you see both succeed and hit the same line where I later get the error. Then at //3 I get the stack trace you see above, it will stall there forever.
I really have no clue how to debug this as there is no exception, it just stops there and the timeout on the Future that sent the message triggers.
Can someone explain how you debug this type of issue?
Thx
David