java.lang.AssertionError: assertion failed in Router

119 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