Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-112

504 when uploading an image

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I've done more digging and this is what I've found so far:

      • The failure point is in Mongo::Connection#receive_message_on_socket
        during the method call to TCPSocket#recv (see stack trace below)
      • A failure means that the code is unresponsive in that thread. It
        does not crash Ruby and you can still access the Rack web app.
      • It fails on Linux but works on Windows
      • Only fails if executed in Rack. Does not fail when just run directly
        as Ruby code.
      • Fails inconsistently. It usually takes a few tries.
      • Only fails against a remote MongoDB server, not a local MongoDB
        server
      • Fails with Rack's Mongrel adapter using the provided test code.
      • Does not fail with Rack's Thin adapter using the provided test code
        but DOES fail when executing in our framework. It's hard to tell what
        in our framework could cause that difference since the framework
        obviously does a lot more than Rack.
      • It feels like differences in timing or combination of events is
        causing the problem since it is never consistent and changing the
        parameters around it unpredictably causes more or less
        unresponsiveness.

      Stack Trace:
      ============================
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:704:in `receive_message_on_socket'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:615:in `receive_header'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:608:in `receive'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:399:in `receive_message'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:397:in `synchronize'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/
      connection.rb:397:in `receive_message'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/cursor.rb:
      339:in `send_initial_query'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/cursor.rb:
      316:in `refill_via_get_more'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/cursor.rb:
      304:in `num_remaining'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/cursor.rb:
      61:in `next_document'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/db.rb:
      442:in `command'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/
      grid_io.rb:319:in `get_md5'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/
      grid_io.rb:310:in `to_mongo_object'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/
      grid_io.rb:169:in `close'",
      "/usr/lib/ruby/gems/1.8/gems/mongo-0.19.1/lib/../lib/mongo/gridfs/
      grid.rb:60:in `put'"

      Rack Script (same as previous post):
      =============================
      require 'rubygems'
      require 'rack'
      require 'mongo'
      require 'logger'
      proc = Proc.new do |env|
      request = Rack::Request.new( env )
      response = Rack::Response.new
      connection = Mongo::Connection.new( "10.1.9.1", 27017, :pool_size =>
      10, :timeout => 2, :logger => Logger.new( "mongo_rack.log" ) )
      db = connection.db( "Production" )
      grid = Mongo::Grid.new( db )
      id = grid.put( 'a' * 1000000, "file.txt" )
      response.write( "This is the file id: #

      { id }

      " )
      response.finish
      end
      app = ( Rack::Builder.new do
      use Rack::Lint
      use Rack::ShowExceptions
      run proc
      end )
      Rack::Handler::Mongrel.run( app, :Port => 9000 )

            Assignee:
            kbanker Kyle Banker
            Reporter:
            kbanker Kyle Banker
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: