History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2508
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: Derek Townsend
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JRuby

Drb Client running on windows opens multiple sockets and the puts them in a time wait

Created: 11/May/08 05:14 PM   Updated: 18/May/08 09:40 AM
Component/s: Core Classes/Modules
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Windows XP, Jruby 1.1.0


 Description  « Hide
When a Drb client runs on windows it create multiple sockets and then immediately closes them. It is only the client code that does this.
When the same code was run under MRI ruby it worked fine.
  1. ==== Client code

  2. require 'drb/drb'
  1. The URI to connect to
    SERVER_URI="druby://localhost:8787"
  1. Start a local DRbServer to handle callbacks.
    #
  2. Not necessary for this small example, but will be required
  3. as soon as we pass a non-marshallable object as an argument
  4. to a dRuby call.
    DRb.start_service

timeserver = DRbObject.new_with_uri(SERVER_URI)

100.times do
sleep(1)
puts timeserver.get_current_time
end

  1. This illustrates setting up a simple client-server drb
  2. system. Run the server and client code in different terminals,
  3. starting the server code first.
    #
  4. ==== Server code

  5. require 'drb/drb'
  1. The URI for the server to connect to
    URI="druby://localhost:8787"

class TimeServer

def get_current_time
return Time.now
end

end

  1. The object that handles requests on the server
    FRONT_OBJECT=TimeServer.new

$SAFE = 1 # disable eval() and friends

DRb.start_service(URI, FRONT_OBJECT)

  1. Wait for the drb server thread to finish before exiting.
    DRb.thread.join

This problem only occurs on windows and only with JRUBY running the client.
Since Drb uses Sockets , it a socket problem.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Derek Townsend - 18/May/08 09:40 AM
Here is a succinct review of the issue. There is no workaround, other than to use a different protocol than the default JRuby DRbTCPSocket, which is NIO-based.

http://forum.java.sun.com/thread.jspa?threadID=579675&messageID=2940535