Avro
  1. Avro
  2. AVRO-537

ruby: keep connection between requests to same client

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.4.1
    • Component/s: ruby
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Currently, all ruby servers will disconnect (sort of) a client after serving one request to said client.

      1. AVRO-537.patch
        1.0 kB
        Doug Cutting

        Activity

        Hide
        Gabor Torok added a comment -

        This is esp. a problem when using avro with cassandra (svn trunk). The 1.3 version of avro won't work with cassandra because of this bug. I made the following change to get it to work:

        The ruby code creates a new http connection for each call to transceive. Here
        is what I changed to make it work:

        gabor$ diff /usr/local/lib/ruby/gems/1.8/gems/avro-1.4.0/lib/avro/ipc.rb
        ~/avro-trunk/lang/ruby/lib/avro/ipc.rb
        518d517
        < require "net/http"
        525d523
        < @conn = Net::HTTP.start host, port
        531c529,531
        < resp = @conn.post('/', writer.to_s,

        {'Content-Type' => 'avro/binary'})

        > resp = Net::HTTP.start(host, port) do |http|
        > http.post('/', writer.to_s, {'Content-Type' => 'avro/binary'}

        )
        > end

        Thanks!

        Show
        Gabor Torok added a comment - This is esp. a problem when using avro with cassandra (svn trunk). The 1.3 version of avro won't work with cassandra because of this bug. I made the following change to get it to work: The ruby code creates a new http connection for each call to transceive. Here is what I changed to make it work: gabor$ diff /usr/local/lib/ruby/gems/1.8/gems/avro-1.4.0/lib/avro/ipc.rb ~/avro-trunk/lang/ruby/lib/avro/ipc.rb 518d517 < require "net/http" 525d523 < @conn = Net::HTTP.start host, port 531c529,531 < resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'}) — > resp = Net::HTTP.start(host, port) do |http| > http.post('/', writer.to_s, {'Content-Type' => 'avro/binary'} ) > end Thanks!
        Hide
        Doug Cutting added a comment -

        I've converted your diff to a patch file. This passes tests for me. Jeff, any objection to committing this?

        Show
        Doug Cutting added a comment - I've converted your diff to a patch file. This passes tests for me. Jeff, any objection to committing this?
        Hide
        Doug Cutting added a comment -

        I just committed this.

        Show
        Doug Cutting added a comment - I just committed this.
        Hide
        Paul Dlug added a comment -

        This was reported as fixed in 1.4.1, I have the latest ruby gem (1.6.1) and the patch is not included.

        Show
        Paul Dlug added a comment - This was reported as fixed in 1.4.1, I have the latest ruby gem (1.6.1) and the patch is not included.
        Hide
        Doug Cutting added a comment -

        When I download from http://rubygems.org/gems/avro/versions/1.6.1 and extract the files, I find that ipc.rb contains the text 'resp = @conn.post' as added by this patch. Whether this patch achieves the desired effect is something that I cannot attest to, since no test was provided with the patch. If this is still a problem, please open a new issue. Thanks!

        Show
        Doug Cutting added a comment - When I download from http://rubygems.org/gems/avro/versions/1.6.1 and extract the files, I find that ipc.rb contains the text 'resp = @conn.post' as added by this patch. Whether this patch achieves the desired effect is something that I cannot attest to, since no test was provided with the patch. If this is still a problem, please open a new issue. Thanks!

          People

          • Assignee:
            Gabor Torok
            Reporter:
            Jeff Hodges
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development