Class: TestBasic::PostInitError
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- TestBasic::PostInitError
- Defined in:
- lib/ext/eventmachine-0.12.10/tests/test_basic.rb
Overview
TODO. This is an unfinished bug fix. This case was originally reported by Dan Aquino. If you throw a Ruby exception in a post_init handler, it gets rethrown as a confusing reactor exception. The problem is in eventmachine.rb, which calls post_init within the private initialize method of the EM::Connection class. This happens in both the EM::connect method and in the code that responds to connection-accepted events. What happens is that we instantiate the new connection object, which calls initialize, and then after initialize returns, we stick the new connection object into EM’s @conns hashtable. But the problem is that Connection::initialize calls #post_init before it returns, and this may be user-written code that may throw an uncaught Ruby exception. If that happens, the reactor will abort, and it will then try to run down open connections. Because @conns never got a chance to properly reflect the new connection (because initialize never returned), we throw a ConnectionNotBound error (eventmachine.rb line 1080). When the bug is fixed, activate this test case.
Instance Attribute Summary
Attributes inherited from EventMachine::Connection
Instance Method Summary collapse
Methods inherited from EventMachine::Connection
#associate_callback_target, #close_connection, #close_connection_after_writing, #comm_inactivity_timeout, #comm_inactivity_timeout=, #connection_completed, #detach, #error?, #get_outbound_data_size, #get_peer_cert, #get_peername, #get_pid, #get_sock_opt, #get_sockname, #get_status, #initialize, new, #notify_readable=, #notify_readable?, #notify_writable=, #notify_writable?, #pause, #paused?, #pending_connect_timeout, #pending_connect_timeout=, #proxy_incoming_to, #proxy_target_unbound, #receive_data, #reconnect, #resume, #send_data, #send_datagram, #send_file_data, #set_comm_inactivity_timeout, #set_pending_connect_timeout, #ssl_handshake_completed, #ssl_verify_peer, #start_tls, #stop_proxying, #stream_file_data, #unbind
Constructor Details
This class inherits a constructor from EventMachine::Connection
Instance Method Details
#post_init ⇒ Object
181 182 183 |
# File 'lib/ext/eventmachine-0.12.10/tests/test_basic.rb', line 181 def post_init aaa bbb # should produce a Ruby exception end |