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?

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 }

路路路

On Feb 17, 2012, at 10:04 , Grigory Petrov wrote:

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?

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:

路路路

On Sat, Feb 18, 2012 at 5:13 AM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Feb 17, 2012, at 10:04 , Grigory Petrov wrote:

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?

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. 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.

路路路

On Feb 18, 2012, at 00:59 , Grigory Petrov 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:

Thanks.

What is the preferred way to file a bugreport?

路路路

On Sat, Feb 18, 2012 at 2:39 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Feb 18, 2012, at 00:59 , Grigory Petrov 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.

- --
All the best, Sandor Sz眉cs

路路路

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

Thanks.

What is the preferred way to file a bugreport?