Skip to content

Instantly share code, notes, and snippets.

@felixyz
Created June 15, 2013 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felixyz/5788285 to your computer and use it in GitHub Desktop.
Save felixyz/5788285 to your computer and use it in GitHub Desktop.
Creating and running >120 Celluloid::IO actors raises an error on MRI, even when doing NO I/O
# Running on OS X
# JRuby + Celluloid = OK
# MRI + Celluloid = OK
# JRuby + Celluloid::IO = OK
# MRI + Celluloid::IO = Too many open files - pipe (Errno::EMFILE)
require 'celluloid/io'
class SimpleActor
# include Celluloid # Creating regular Celluloid actors works on MRI
include Celluloid::IO # Creating >120 (approx.) Celluloid::IO actors on MRI rasies Too many open files - pipe (Errno::EMFILE)
def do_work(id)
puts "[#{id}] Starting..."
result = 0
10_000.times do
result += rand 1..8
end
result
end
end
results = 1_000.times.map { |n|
SimpleActor.new.future :do_work, n
}.each{|future| puts future.value }
@felixyz
Copy link
Author

felixyz commented Jun 15, 2013

The actual problem is with MRI, not Celluloid::IO: https://gist.github.com/Felixyz/5788375

@felixyz
Copy link
Author

felixyz commented Jun 15, 2013

The actual problem is not with MRI but with a low default limit number of allowed file descriptors on OSX (10.8.2)

@nicksoto
Copy link

nicksoto commented Feb 5, 2014

@felixyz, i just came across this (obscure) error. have you found any other solutions? i'm looking for a way to terminate existing Celluloid actors without having to raise the open files limit on the system.

@blanchma
Copy link

blanchma commented Nov 6, 2014

@nicksoto @felixz did you a find a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment