How to shutdown Ruby XMLRPC server?

Hello. I’m testing Ruby XMLRPC support right now. All works fine,
except XMLRPC::Server#shutdown :frowning: If i run following ruby 1.9.3 test
code, it fails to shutdown server on both Windows 7 and OSX 10.7:

server.rb

require “xmlrpc/server”
require ‘thread’
Thread.new { sleep 10; $server.shutdown() }
$server = XMLRPC::Server.new( 1234 )
$server.add_handler( “test” ) { true }
$server.serve()

client.rb

require “xmlrpc/client”
server = XMLRPC::Client.new( “localhost”, “/”, 1234 )
loop { server.call( “test” ); sleep 0.1 }

After 10 seconds the server writes “INFO going to shutdown …” to
stdout, but don’t actually shut down and continues to handle incoming
requests :(. What i’m doing wrong?

On Feb 17, 2012, at 10:04 , Grigory P. wrote:

$server.add_handler( “test” ) { true }
requests :(. What i’m doing wrong?
Nothing wrong that I can see. I can repro your issue as well.
XMLRPC::Server#shutdown just calls shutdown on the webrick server and I
use that all the time like so:

trap(“INT”) { s.shutdown }

Sorry, my english is not very good :(. What do you mean by both
“nothing wrong” and “i can repro your issue” statements? If you can
reproduce my issue, it clearly states what is wrong: XMLRPC server
simply don’t shutdown O_O.

Of course it will shutdown if no clients are connected. But seems that
it can’t shutdown if client is connected :frowning:

Thanks.

What is the preferred way to file a bugreport?

On Feb 18, 2012, at 00:59 , Grigory P. wrote:

Sorry, my english is not very good :(. What do you mean by both
“nothing wrong” and “i can repro your issue” statements? If you can
reproduce my issue, it clearly states what is wrong: XMLRPC server
simply don’t shutdown O_O.

Of course it will shutdown if no clients are connected. But seems that
it can’t shutdown if client is connected :frowning:

Sorry. I should have been more clear.

I agree. I think you found a bug.

It looks like the bug is in webrick::server, not xmlrpc::server.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2/18/12 11:53 AM, Grigory P. wrote:

Thanks.

What is the preferred way to file a bugreport?

http://bugs.ruby-lang.org/


All the best, Sandor Sz

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs