Giter VIP home page Giter VIP logo

Comments (2)

fw42 avatar fw42 commented on June 9, 2024

Nevermind, I just noticed that my box has 1.9.2 and not 1.9.3. Sorry :-)

from celluloid-io.

benlangfeld avatar benlangfeld commented on June 9, 2024

First, nit-pick: Ruby makes your life easy:

255.times do
...
end

As for your actual issue, what happens when you use threads and normal ruby
sockets?

Regards,
Ben Langfeld

On 19 September 2012 15:11, Florian Weingarten [email protected]:

Hey guys! When I run the following code:

#!/usr/bin/ruby1.9.1

require 'rubygems'
require 'celluloid/io'

class Client
include Celluloid::IO
def initialize(host, port) @socket = TCPSocket.new(host, port) end
def read() @socket.readpartial(100) end
end

for i in 0..255 do
client = Client.new("127.0.0.1", 1234)
puts client.read()
end

I get a segfault:

/var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/reactor.rb:16: [BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

-- control frame ----------
c:0020 p:---- s:0060 b:0060 l:000059 d:000059 CFUNC :(null)
c:0019 p:---- s:0058 b:0058 l:000057 d:000057 CFUNC :new
c:0018 p:0019 s:0055 b:0055 l:000054 d:000054 METHOD /var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/reactor.rb:16
c:0017 p:---- s:0052 b:0052 l:000051 d:000051 FINISH
c:0016 p:---- s:0050 b:0050 l:000049 d:000049 CFUNC :new
c:0015 p:0051 s:0047 b:0047 l:000046 d:000046 METHOD /var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/mailbox.rb:10
c:0014 p:---- s:0043 b:0043 l:000042 d:000042 FINISH
c:0013 p:---- s:0041 b:0041 l:000040 d:000040 CFUNC :new
c:0012 p:0011 s:0038 b:0038 l:001750 d:000037 BLOCK /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:142
c:0011 p:---- s:0036 b:0036 l:000035 d:000035 FINISH
c:0010 p:---- s:0034 b:0034 l:000033 d:000033 CFUNC :call
c:0009 p:0025 s:0031 b:0031 l:000030 d:000030 METHOD /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:171
c:0008 p:0013 s:0028 b:0027 l:000026 d:000026 METHOD /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:182
c:0007 p:0025 s:0024 b:0022 l:000021 d:000021 METHOD /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:78
c:0006 p:0025 s:0016 b:0016 l:002688 d:000015 BLOCK ./client.rb:13
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :each
c:0003 p:0044 s:0008 b:0008 l:002688 d:000c58 EVAL ./client.rb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH

c:0001 p:0000 s:0002 b:0002 l:002688 d:002688 TOP

-- Ruby level backtrace information ----------------------------------------
./client.rb:12:in <main>' ./client.rb:12:ineach'
./client.rb:13:in block in <main>' /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:78:innew'
/var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:182:in actor_options' /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:171:inmailbox_factory'
/var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:171:in call' /var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:142:inblock in mailbox_class'
/var/lib/gems/1.9.1/gems/celluloid-0.12.0/lib/celluloid.rb:142:in new' /var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/mailbox.rb:10:ininitialize'
/var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/mailbox.rb:10:in new' /var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/reactor.rb:16:ininitialize'
/var/lib/gems/1.9.1/gems/celluloid-io-0.12.0/lib/celluloid/io/reactor.rb:16:in `new'
zsh: segmentation fault ./client.rb

When I change 255 to 254, everything works as expected.

Am I missing something or is this is a bug?

Thanks!
Flo


Reply to this email directly or view it on GitHubhttps://github.com//issues/26.

from celluloid-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.