Skip to content

Timeout on JRuby on Windows #50

@joankaradimov

Description

@joankaradimov

I am experiencing an issue in multipart-post 2.0.0. I have a client piece of code that looks roughly like this:

require 'net/http'
require 'net/http/post/multipart'

http = Net::HTTP.new('localhost', 8080)

http.start do |http|
  File.open('C:/data/asd.png') do |png|
    req = Net::HTTP::Post::Multipart.new('http://localhost:8080/some-endpoint',
      'uploadId' => "some-internal-data",
      'files[]' => UploadIO.new(png, 'image/png', 'asd.png'),
      'size' => 186670,
      )

    # Some headers for session ID and CSRF protection
    req['Cookie'] = "JSESSIONID=1234567890abcdef"
    req['X-Requested-By'] = 'UNUSED'

    http.request(req)
  end
end

The code runs on JRuby 9.1.6.0 on Windows 10. When I run it I get this stack trace:

Net::ReadTimeout: Net::ReadTimeout
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/protocol.rb:158:in `rbuf_fill'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/protocol.rb:136:in `readuntil'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/protocol.rb:146:in `readline'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http/response.rb:40:in `read_status_line'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http/response.rb:29:in `read_new'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http.rb:1448:in `block in transport_request'
        from org/jruby/RubyKernel.java:1118:in `catch'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http.rb:1445:in `transport_request'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http.rb:1418:in `request'
        from (irb):19:in `block in evaluate'
        from org/jruby/RubyIO.java:1141:in `open'
        from (irb):11:in `block in evaluate'
        from C:/dev/jruby-9.1.6.0/lib/ruby/stdlib/net/http.rb:858:in `start'
        from (irb):10:in `<eval>'
        from org/jruby/RubyKernel.java:998:in `eval'
        from org/jruby/RubyKernel.java:1299:in `loop'
        from org/jruby/RubyKernel.java:1118:in `catch'
        from org/jruby/RubyKernel.java:1118:in `catch'
        from jirb:13:in `<main>'

On the server side there is a Java + Tomcat on Windows. The output from the server is java.net.SocketTimeoutException: null. The stack trace on the server is most likely irrelevant.

I've tried identical code on a JRuby/Linux client with the exact same Java/Windows server and it worked. Furthermore - I tried MRI/Windows client and it worked too. I also tried some older builds of JRuby I have locally and they failed. So there appears to be some incompatibility in multipart-post with JRuby on Windows.

I'm not even sure if I should be logging this here. Still it's probably good to have it here so that it's visible for users of the library. Is there something that can be done other than forwarding this to the JRuby guys?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions