java.lang.AssertionError: assertion failed in Router

118 views
Skip to first unread message

krishnen

unread,
May 16, 2012, 9:39:04 AM5/16/12
to akka...@googlegroups.com
Hi All,

I am using Akka 2.0.1 in my application. I make use of a remote router which i initialize on startup of the application as follows: 

val frameworkAddress = Seq(Address("akka", "FrameworkApplication",
      config.getString("framework.ip-address"),
      config.getInt("framework.akka.remote.netty.port")))

system.actorOf(Props[FrameworkActor].withRouter(
      RemoteRouterConfig(SmallestMailboxRouter(resizer = Some(DefaultResizer(
        lowerBound = 1, upperBound = 10)), routerDispatcher = "framework-dispatcher"),
        frameworkAddress)),
        "framework_server")


The framework-dispatcher is defined in the config is defined as follows : 

framework-dispatcher {
  type = BalancingDispatcher
  executor = "fork-join-executor"
  }


I send a few messages remotely to the router, the first few go through correctly, but at some point the app falls over with this exception:

[ERROR] [05/16/2012 16:32:22.487] [FrameworkApplication-akka.actor.default-dispatcher-5] [akka://FrameworkApplication/user] assertion failed
java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:89)
at akka.routing.Router$$anonfun$receive$1.apply(Routing.scala:309)
at akka.routing.Router$$anonfun$receive$1.apply(Routing.scala:305)
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:45)
at akka.actor.Actor$class.apply(Actor.scala:311)
at akka.routing.RouterConfig$$anon$1.apply(Routing.scala:176)
at akka.actor.ActorCell.invoke(ActorCell.scala:619)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196)
at akka.dispatch.Mailbox.run(Mailbox.scala:178)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:505)
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

I had a quick look at the code, it seems the problem is with router resizing. Can someone point to me what i am doing wrong?

I am running Akka on :
Ubuntu 11.10 
Scala 2.9.1
OpenJDK Runtime Environment (IcedTea7 2.0pre) (7~b147-2.0~pre6-1ubuntu1~ppa1)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

If more info needed let me know.

Thanks!




Jonas Boner

unread,
May 16, 2012, 9:47:42 AM5/16/12
to akka...@googlegroups.com
Sounds like a bug. Do you have a failing test? That would help a lot. Thanks.
> --
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/akka-user/-/hKnkxMjTshcJ.
> To post to this group, send email to akka...@googlegroups.com.
> To unsubscribe from this group, send email to
> akka-user+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akka-user?hl=en.



--
Jonas Bonér
CTO
Typesafe - The software stack for applications that scale
Phone: +46 733 777 123
Twitter: @jboner

√iktor Ҡlang

unread,
May 16, 2012, 9:50:19 AM5/16/12
to akka...@googlegroups.com
Yeah open a ticket. But also, it doesn't make sense at all to have a BalancingDispatcher with a SmallestMailboxRouter...

Cheers,
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

krishnen

unread,
May 16, 2012, 1:43:11 PM5/16/12
to akka...@googlegroups.com
Hello,

I made a small demo project to illustrate the problem :

https://github.com/krishnenc/routing-akka

Viktor : Removing the balancing dispatcher does indeed prevent the exception

Thks,
Krishnen

√iktor Ҡlang

unread,
May 16, 2012, 1:48:36 PM5/16/12
to akka...@googlegroups.com
On Wed, May 16, 2012 at 7:43 PM, krishnen <kris...@gmail.com> wrote:
Hello,

I made a small demo project to illustrate the problem :

https://github.com/krishnenc/routing-akka

Viktor : Removing the balancing dispatcher does indeed prevent the exception

As I expected then. A remote SmallestMailboxFirst Router, with a Resizer, with a BalancingDispatcher is just a bad idea on all levels.

Great that the assertion was there!

Cheers,
 

Thks,
Krishnen
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/jG-UjDAfmSsJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Jonas Boner

unread,
May 16, 2012, 2:52:08 PM5/16/12
to akka...@googlegroups.com
On Wed, May 16, 2012 at 7:48 PM, √iktor Ҡlang <viktor...@gmail.com> wrote:
>
>
> On Wed, May 16, 2012 at 7:43 PM, krishnen <kris...@gmail.com> wrote:
>>
>> Hello,
>>
>> I made a small demo project to illustrate the problem :
>>
>> https://github.com/krishnenc/routing-akka
>>
>> Viktor : Removing the balancing dispatcher does indeed prevent the
>> exception
>
>
> As I expected then. A remote SmallestMailboxFirst Router, with a Resizer,
> with a BalancingDispatcher is just a bad idea on all levels.

Indeed bad. But it should not fail like this. Add a ticket.
Jonas Bonér
CTO
Typesafe - The software stack for applications that scale

√iktor Ҡlang

unread,
May 16, 2012, 3:02:39 PM5/16/12
to akka...@googlegroups.com

How should it fail?

Cheers,
V

Jonas Boner

unread,
May 16, 2012, 3:08:11 PM5/16/12
to akka...@googlegroups.com
On Wed, May 16, 2012 at 9:02 PM, √iktor Ҡlang <viktor...@gmail.com> wrote:
> How should it fail?
>

With an exception with a proper error message of course.

√iktor Ҡlang

unread,
May 16, 2012, 3:18:05 PM5/16/12
to akka...@googlegroups.com

That's the easy part, the hard part is where to put that check.

Jonas Boner

unread,
May 17, 2012, 7:51:28 AM5/17/12
to akka...@googlegroups.com

You'll figure it out ;-)

√iktor Ҡlang

unread,
May 17, 2012, 7:54:24 AM5/17/12
to akka...@googlegroups.com
On Thu, May 17, 2012 at 1:51 PM, Jonas Boner <jo...@jonasboner.com> wrote:

You'll figure it out ;-)

Nah, looking forward to your pull request since you claimed it was easy. ;-)

Akka Team

unread,
May 17, 2012, 8:13:16 AM5/17/12
to akka...@googlegroups.com

LOL. I'll take a look.

√iktor Ҡlang

unread,
May 17, 2012, 8:16:03 AM5/17/12
to akka...@googlegroups.com
On Thu, May 17, 2012 at 2:13 PM, Akka Team <akka.o...@gmail.com> wrote:

LOL. I'll take a look.

We should probably just issue a check for using BalancingDispatcher with a router at all, since it doesn't make any sense really.

Jonas Boner

unread,
May 17, 2012, 8:23:38 AM5/17/12
to akka...@googlegroups.com

That is the plan

√iktor Ҡlang

unread,
May 17, 2012, 8:27:45 AM5/17/12
to akka...@googlegroups.com


On Thu, May 17, 2012 at 2:23 PM, Jonas Boner <jo...@jonasboner.com> wrote:

That is the plan

However, that won't help with custom dispatchers.

Roland Kuhn

unread,
May 25, 2012, 10:29:38 AM5/25/12
to akka...@googlegroups.com
Hi folks,

sorry, I’m very late to the party, but re-reading this I think the change in https://github.com/akka/akka/pull/464 is not needed, since the problem is only that the head router must not run on a “weird” dispatcher. So, Props.dispatcher==BalancingDispatcher is fine for a router while RouterConfig.routerDispatcher==BalancingDispatcher is not. The wording in the docs is less clear than it could be (and I’m accusing myself here, IIRC) and it does not explain which specific combination is bad precisely why.

I’ll open a new ticket to fix the fix.

Regards,

Roland

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/hKnkxMjTshcJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


√iktor Ҡlang

unread,
May 25, 2012, 10:31:04 AM5/25/12
to akka...@googlegroups.com
On Fri, May 25, 2012 at 4:29 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
Hi folks,

sorry, I’m very late to the party, but re-reading this I think the change in https://github.com/akka/akka/pull/464 is not needed, since the problem is only that the head router must not run on a “weird” dispatcher. So, Props.dispatcher==BalancingDispatcher is fine for a router while RouterConfig.routerDispatcher==BalancingDispatcher is not. The wording in the docs is less clear than it could be (and I’m accusing myself here, IIRC) and it does not explain which specific combination is bad precisely why.

I’ll open a new ticket to fix the fix.

Nice catch! Cigar

Cheers,



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Jonas Bonér

unread,
May 25, 2012, 11:05:50 AM5/25/12
to akka...@googlegroups.com
Ah, good catch.
Jonas Bonér
CTO

Typesafe - The software stack for applications that scale

√iktor Ҡlang

unread,
May 25, 2012, 11:44:06 AM5/25/12
to akka...@googlegroups.com


On Fri, May 25, 2012 at 5:05 PM, Jonas Bonér <jo...@jonasboner.com> wrote:
Ah, good catch.


Reply all
Reply to author
Forward
0 new messages