我XMLRPC::Client
在 Ruby 中使用(对于 ruby 1.8 到 2.0 的行为相同)向服务器发送调用,如下所示:
server = XMLRPC::Client.new2( url )
server.timeout = 300
response = server.call( "service.methodname", bigarray )
一切正常,只要bigarray
传递的不是太大。从它包含大约 10K 浮点数的那一刻起,我得到以下错误跟踪:
$ ruby client_largeinputset.rb
/Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/protocol.rb:153:in `read_nonblock': Connection reset by peer (Errno::ECONNRESET)
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/protocol.rb:153:in `rbuf_fill'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/protocol.rb:122:in `read_all'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:292:in `block in read_body_0'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:269:in `inflater'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:274:in `read_body_0'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:201:in `read_body'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:226:in `body'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:163:in `reading_body'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1411:in `block in transport_request'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `catch'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1375:in `request'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1321:in `request_post'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/xmlrpc/client.rb:477:in `do_rpc'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/xmlrpc/client.rb:281:in `call2'
from /Users/aliekens/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/xmlrpc/client.rb:262:in `call'
from client_largeinputset.rb:28:in `<main>'
我不知道 XMLRPC 规范中的调用大小限制,但在我的工作流程中似乎存在限制。
首先:这是我的 ruby 客户端的问题,还是我的服务器(使用 xmlrpc-c,通过深渊 HTTP 服务器编写)可能不接受大请求的问题?
如果它在客户端,那么有没有办法绕过这个问题?我可以在客户端更改呼叫请求的大小(如果有限制)?是否有任何替代路由(除了 ruby 的本机 XMLRPC::Client 实现)可以规避这个问题?最好我正在寻找一种在客户端解决此问题而无需调整服务器端的解决方案,除非它确实是服务器大小的问题。