Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example28_networking uninitialized constant IO::WaitReadable + possible fix #4

Open
flipcoder opened this issue Sep 21, 2011 · 3 comments

Comments

@flipcoder
Copy link
Member

I get an error when I try to run example28_networking (error occurs in chingu/lib/chingu/game_states/network_server.rb line 208). I'm not too familiar with ruby yet but it looks like an exception had an invalid type or something.

By changing line 208 to:

rescue Errno::EAGAIN, Errno::EINTR

It works. Should I commit this or am I missing something?

The full error is here:

$ ruby example28_networking.rb 
/home/flipcoder/Projects/School/ChicoTeam/chingu/lib/chingu/game_states/network_server.rb:208:in `handle_incoming_connections': uninitialized constant IO::WaitReadable (NameError)
    from /home/flipcoder/Projects/School/ChicoTeam/chingu/lib/chingu/game_states/network_server.rb:176:in `update'
    from example28_networking.rb:32:in `update'
    from example28_networking.rb:80
@flipcoder
Copy link
Member Author

Decided to commit the change. We can always go back if necessary.

@cqcallaw
Copy link

The relevant bit from the stack trace seems to be "uninitialized constant IO::WaitReadable".

IO::WaitReadable is documented here: http://www.ruby-doc.org/core-1.9/classes/IO/WaitReadable.html. Certainly doesn't seem like an exception type.

However, searching for "rescue IO::WaitReadable" yields results such as http://stackoverflow.com/questions/7127603/why-is-iowaitreadable-being-raised-differently-for-stdout-than-stderr-ruby-1 and http://ruby-doc.org/stdlib/libdoc/socket/rdoc/classes/TCPServer.html, so it seems like a valid construct. The second hit, http://lists.macosforge.org/pipermail/macruby-devel/2010-May/005127.html, is also interesting because it seems like a very similar bug report.

I'd also hesitate to say Errno::EAGAIN is the correct fix until you've figured out what exceptions could possibly be raised by the begin block...

References for Ruby exception handling (based on a quick search, not extensive study):
http://ruby-doc.org/docs/ProgrammingRuby/html/tut_exceptions.html
http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_m_errno.html

@flipcoder
Copy link
Member Author

Thanks for the info. I wasn't clear in my post about the reason I added Errno::EAGAIN. That was another unhandled exception I received after removing the IO::WaitReadable. I agree with your suggestion and am still unsure about this being the final solution, but wanted to commit these changes so we could see if it was a problem with something on my machine or not. I'll reopen the issue.

@flipcoder flipcoder reopened this Sep 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants