The dreaded "ClosedChannelException: null"

231 views
Skip to first unread message

Daniel Glauser

unread,
Apr 26, 2011, 7:58:21 PM4/26/11
to Akka User List
Hello akkers,

I've got a really simple project to test out remote actors up on
github: https://github.com/danielglauser/remote-actor-prototype. A
server starts two actors, a client fires off a bunch of messages to
those actors. I keep getting the dreaded
"java.nio.channels.ClosedChannelException: null". I did RTFM and read
about the backlog setting which I do set in my akka.conf file. Any
hints would be appreciated.

Please note I'm building with Gradle (too many issues with SBT)
against Akka 1.0. Instructions are in the README file for the
project.

Let me know if you have any clues.

Thanks,
Daniel

Jonas Bonér

unread,
Apr 27, 2011, 5:22:58 AM4/27/11
to akka...@googlegroups.com
Thanks for posting. Great if you have a sample project triggering the
problem. I want this bastard nailed now.
Can you submit a ticket and link to the project and I'll make sure it
gets high prio. I am just refactoring/rewriting all remoting for 2.0
so this is the time to fix all these issues.

> --
> You received this message because you are subscribed to the Google Groups "Akka User List" group.
> 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

Specialist at Large
work: http://scalablesolutions.se
code: http://akka.io
blog: http://jonasboner.com
twtr: @jboner

√iktor Ҡlang

unread,
Apr 27, 2011, 5:24:47 AM4/27/11
to akka...@googlegroups.com
Hi Daniel,

On Wed, Apr 27, 2011 at 1:58 AM, Daniel Glauser <dangl...@gmail.com> wrote:
Hello akkers,

I've got a really simple project to test out remote actors up on
github: https://github.com/danielglauser/remote-actor-prototype.  A
server starts two actors, a client fires off a bunch of messages to
those actors.  I keep getting the dreaded
"java.nio.channels.ClosedChannelException: null".  I did RTFM and read
about the backlog setting which I do set in my akka.conf file.  Any
hints would be appreciated.

What have you set it to?
 

Please note I'm building with Gradle (too many issues with SBT)
against Akka 1.0.  Instructions are in the README file for the
project.

Let me know if you have any clues.

Try 1.1-M1, I've had reports of this problem not occurring there.

Cheers,
 

Thanks,
Daniel

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
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.




--
Viktor Klang,
Director of Research and Development
Scalable Solutions

Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

Jonas Bonér

unread,
Apr 27, 2011, 5:32:59 AM4/27/11
to akka...@googlegroups.com
2011/4/27 √iktor Ҡlang <viktor...@gmail.com>:

> Hi Daniel,
>
> On Wed, Apr 27, 2011 at 1:58 AM, Daniel Glauser <dangl...@gmail.com>
> wrote:
>>
>> Hello akkers,
>>
>> I've got a really simple project to test out remote actors up on
>> github: https://github.com/danielglauser/remote-actor-prototype.  A
>> server starts two actors, a client fires off a bunch of messages to
>> those actors.  I keep getting the dreaded
>> "java.nio.channels.ClosedChannelException: null".  I did RTFM and read
>> about the backlog setting which I do set in my akka.conf file.  Any
>> hints would be appreciated.
>
> What have you set it to?
>

In some use-cases something like at least 4096 is needed I think. 1024
is (sometimes) low default.

>>
>> Please note I'm building with Gradle (too many issues with SBT)
>> against Akka 1.0.  Instructions are in the README file for the
>> project.
>>
>> Let me know if you have any clues.
>
> Try 1.1-M1, I've had reports of this problem not occurring there.

If so, great. What fixed it in master?

--

√iktor Ҡlang

unread,
Apr 27, 2011, 5:54:09 AM4/27/11
to akka...@googlegroups.com
On Wed, Apr 27, 2011 at 11:32 AM, Jonas Bonér <jo...@jonasboner.com> wrote:
2011/4/27 √iktor Ҡlang <viktor...@gmail.com>:
> Hi Daniel,
>
> On Wed, Apr 27, 2011 at 1:58 AM, Daniel Glauser <dangl...@gmail.com>
> wrote:
>>
>> Hello akkers,
>>
>> I've got a really simple project to test out remote actors up on
>> github: https://github.com/danielglauser/remote-actor-prototype.  A
>> server starts two actors, a client fires off a bunch of messages to
>> those actors.  I keep getting the dreaded
>> "java.nio.channels.ClosedChannelException: null".  I did RTFM and read
>> about the backlog setting which I do set in my akka.conf file.  Any
>> hints would be appreciated.
>
> What have you set it to?
>

In some use-cases something like at least 4096 is needed I think. 1024
is (sometimes) low default.

Indeed.
 

>>
>> Please note I'm building with Gradle (too many issues with SBT)
>> against Akka 1.0.  Instructions are in the README file for the
>> project.
>>
>> Let me know if you have any clues.
>
> Try 1.1-M1, I've had reports of this problem not occurring there.

If so, great. What fixed it in master?

I added an execution handler, that will take the pressure off the IO threads, it's configurable in the akka.conf, it's documented and ready to rumble.
 

Jonas Bonér

unread,
Apr 27, 2011, 5:57:27 AM4/27/11
to akka...@googlegroups.com
2011/4/27 √iktor Ҡlang <viktor...@gmail.com>:

I missed that. Very cool. You are too productive for your own good.

Daniel Glauser

unread,
Apr 27, 2011, 10:46:29 AM4/27/11
to Akka User List
You gentlemen rock.

After I posted my sample code I swapped out ! for !! and the problem
went away. I'm aware that I will probably want to change that back
over the long term.

I read up for a while on this issue so I changed my backlog value to:
backlog = 4096

I'll give 1.1-M1 a try today. Is that up on a Maven/Ivy server
somewhere or should I build from scratch? If I build from scratch
should I try trunk or specifically 1.1-M1?

Victor, do you have a link to the docs on the execution handler
settings? I took a peek in the code and it looks like you added
http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html
to akka.remote.netty.NettyRemoteSupport.scala.

One problem I've had previously is I put the setting for the backlog
in my akka.conf file but due to mistakes in the file it wasn't being
loaded. Any thoughts on a rough validator for the conf file?

Thanks for all your help,
Daniel


On Apr 27, 3:57 am, Jonas Bonér <jo...@jonasboner.com> wrote:
> 2011/4/27 √iktor Ҡlang <viktor.kl...@gmail.com>:
>
>
>
>
>
>
>
>
>
>
>
> > On Wed, Apr 27, 2011 at 11:32 AM, Jonas Bonér <jo...@jonasboner.com> wrote:
>
> >> 2011/4/27 √iktor Ҡlang <viktor.kl...@gmail.com>:
> >> > Hi Daniel,
>
> >> > On Wed, Apr 27, 2011 at 1:58 AM, Daniel Glauser <danglau...@gmail.com>

√iktor Ҡlang

unread,
Apr 27, 2011, 10:51:44 AM4/27/11
to akka...@googlegroups.com


On Wed, Apr 27, 2011 at 4:46 PM, Daniel Glauser <dangl...@gmail.com> wrote:
You gentlemen rock.


Well thank you!
 
After I posted my sample code I swapped out ! for !! and the problem
went away.  I'm aware that I will probably want to change that back
over the long term.

Alright, well that's probably just because you're taking the pressure off the remoting by doing blocking for the response.
 

I read up for a while on this issue so I changed my backlog value to:
backlog = 4096

I'll give 1.1-M1 a try today.  Is that up on a Maven/Ivy server
somewhere or should I build from scratch?  If I build from scratch
should I try trunk or specifically 1.1-M1?


It's available from the akka.io repository
 
Victor, do you have a link to the docs on the execution handler
settings?  I took a peek in the code and it looks like you added
http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html
to akka.remote.netty.NettyRemoteSupport.scala.

http://doc.akka.io/configuration

specifically:
 server {
...
 backlog = 4096 # Sets the size of the connection backlog execution-pool-keepalive = 60# Length in akka.time-unit how long core threads will be kept alive if idling execution-pool-size = 16# Size of the core pool of the remote execution unit max-channel-memory-size = 0 # Maximum channel size, 0 for off max-total-memory-size = 0 # Maximum total size of all channels, 0 for off }

 

One problem I've had previously is I put the setting for the backlog
in my akka.conf file but due to mistakes in the file it wasn't being
loaded.  Any thoughts on a rough validator for the conf file?

Thanks for all your help,

You're welcome,


Happy hAkking!
 

Daniel Glauser

unread,
Apr 27, 2011, 2:17:58 PM4/27/11
to Akka User List
My code now builds against Akka 1.1-M1 with Scala 2.9.0.RC2. And it
looks like I got my wish, I now see when there are errors in my
akka.conf file. The bad news is I can't seem to get the file to
parse. I started with a cut-n-paste version from the config docs and
trimmed it back to a minimal file.

####################
# Akka Config File #
####################

# This file has all the default settings, so all these could be
removed with no visible effect.
# Modify as needed.

akka {
version = "1.1-M1" # Akka version, checked against the runtime
version of Akka.

enabled-modules = ["remote"] # Comma separated list of the
enabled modules. Options: ["remote", "camel", "http"]

time-unit = "seconds" # Time unit for all timeout properties
throughout the config
}

Loading config from -Dakka.config=./src/main/resources/proto-akka.conf
Couldn't parse config, fatal error.
java.lang.NoSuchMethodError: scala.collection.mutable.Stack
$.apply(Lscala/collection/Seq;)Lscala/collection/Traversable;
at akka.config.ConfigParser.<init>(ConfigParser.scala:16)
at akka.config.Configuration$.load(Configuration.scala:19)
at akka.config.Configuration$.fromFile(Configuration.scala:24)
at akka.config.Configuration$.fromFile(Configuration.scala:29)
at akka.config.Configuration$.fromFile(Configuration.scala:37)

I tried looking in ConfigParser line 16 from master up on github:
val sections = mutable.Stack[String]()

Which doesn't make any sense to me unless I am hitting a scala version
issue. I tried 2.8.0, 2.8.1, 2.9.0.RC1, and 2.9.0.RC2. I got
different errors with the 2.8 series but haven't gotten anything to
work. I also tried commenting out the entire config file to see if
that helped. In addition I've changed the name of the config file and
specifying it at the command line (-Dakka.config="./src/main/resources/
proto-akka.conf") to make sure I'm not picking up the wrong file. You
can see from the output above that Akka is finding the right file
(there is only one copy of the file on my system). As before the code
is up on Github (https://github.com/danielglauser/remote-actor-
prototype) if that helps.

I noticed that there isn't a 1.1-M1 branch on Github (git branch -r).
Trying to make sure I'm looking at the right Akka code when debugging
this stuff.

Thanks again,
Daniel


On Apr 27, 8:51 am, √iktor Ҡlang <viktor.kl...@gmail.com> wrote:
> On Wed, Apr 27, 2011 at 4:46 PM, Daniel Glauser <danglau...@gmail.com>wrote:
>
> > You gentlemen rock.
>
> Well thank you!
>
> > After I posted my sample code I swapped out ! for !! and the problem
> > went away.  I'm aware that I will probably want to change that back
> > over the long term.
>
> Alright, well that's probably just because you're taking the pressure off
> the remoting by doing blocking for the response.
>
>
>
> > I read up for a while on this issue so I changed my backlog value to:
> > backlog = 4096
>
> > I'll give 1.1-M1 a try today.  Is that up on a Maven/Ivy server
> > somewhere or should I build from scratch?  If I build from scratch
> > should I try trunk or specifically 1.1-M1?
>
> It's available from the akka.io repository
>
> > Victor, do you have a link to the docs on the execution handler
> > settings?  I took a peek in the code and it looks like you added
>
> >http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution...
> > to akka.remote.netty.NettyRemoteSupport.scala.
>
> http://doc.akka.io/configuration
>
> specifically:
>
>  server {
>      ...
>       backlog = 4096               # Sets the size of the connection backlog
>       execution-pool-keepalive = 60# Length in akka.time-unit how long
> core threads will be kept alive if idling
>       execution-pool-size      = 16# Size of the core pool of the
> remote execution unit
>       max-channel-memory-size  = 0 # Maximum channel size, 0 for off
>       max-total-memory-size    = 0 # Maximum total size of all
> channels, 0 for off
>     }
>
>
>
> > One problem I've had previously is I put the setting for the backlog
> > in my akka.conf file but due to mistakes in the file it wasn't being
> > loaded.  Any thoughts on a rough validator for the conf file?
>
> https://www.assembla.com/spaces/akka/tickets/573-akka-should-warn-the...
> Scalable Solutions <http://www.scalablesolutions.se>

√iktor Ҡlang

unread,
Apr 27, 2011, 2:24:21 PM4/27/11
to akka...@googlegroups.com

1.1-M1 uses scala 2.9.0.RC1 and it's a tag in github,
Your error seems to look like version problems

Reply all
Reply to author
Forward
0 new messages