Giter VIP home page Giter VIP logo

Comments (5)

tarcieri avatar tarcieri commented on June 9, 2024

The server is crashing with IOError, which is unhandled.

Try adding a rescue IOError here alongside EOFError:

https://github.com/celluloid/celluloid-io/blob/master/examples/echo_server.rb#L33

from celluloid-io.

cognitiveflux avatar cognitiveflux commented on June 9, 2024

Adding the rescue IOError passes the tests and all the remaining connections stay open, but I'm curious why an IOError is raised in the first place. Writing an echo server using 'socket' and ruby threads doesn't raise an IOError when a socket connection is closed (only the client raises Errno::EPIPE, but nothing is raised on the server). Is this an issue coming from evented IO? Is there a better way to terminate the socket and associated fiber so that it doesn't raise?

from celluloid-io.

tarcieri avatar tarcieri commented on June 9, 2024

EOFError, IOError, Errno::ECONNRESET, and Errno::EPIPE are all exceptions that indicate a socket error. You might notice the many different ways that socket closure is detected on e.g. IRC servers.

echo_server.rb should probably reflect this, however, what I've been wanting to make is a more high-level abstraction for developing network servers which wraps up these concerns.

The reason why there's a multitude of potential exceptions is because Celluloid::IO tries to be a low-level wrapper which doesn't abstract away these concerns, as opposed to something like EventMachine which is a high-level wrapper that forces a particular programming paradigm onto developers.

from celluloid-io.

cognitiveflux avatar cognitiveflux commented on June 9, 2024

I'll close out the ticket then if it is executing as expected.

Were your thoughts on a higher level abstraction to create something similar to the level as EventMachine or EventMachine::WebSocket? Have you created a draft specification of what you're looking for from such an abstraction so that others could contribute towards the effort?

from celluloid-io.

tarcieri avatar tarcieri commented on June 9, 2024

On Wed, May 14, 2014 at 9:54 AM, cognitiveflux [email protected]:

Were your thoughts on a higher level abstraction to create something
similar to the level as EventMachine or EventMachine::WebSocket?

With a completely different (synchronous) API, but perhaps similar ease of
use

Have you created a draft specification of what you're looking for from
such an abstraction so that others could contribute towards the effort?

I think the best approach would be an extraction from Reel (rewriting Reel
on top of it at the same time), namely Reel::Server::HTTP (as
Whatever::TCPServer), Reel::Server::SSL (as Whatever::SSLServer), and
Reel::Connection (as Whatever::Connection)

Tony Arcieri

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.