3

私のコントローラーは、特定のクリックでデータをfirebaseにプッシュします。

class FirebaseController < ApplicationController

    Firebase.base_uri = "https://firebaseProject.Firebaseio.com/"  

    def call_to_firebase

        Firebase.push("firebase_channel", "firebase_data".to_json)

        respond_to do |format|
        format.json { render nothing: true, :status => 204 }
        end
    end
end

クリックで呼び出されるこのコントローラーへの迅速な連続呼び出しの場合、私の Puma サーバーはすぐにクラッシュします。

Rails 4.0.0 Puma 2.6.0 Ruby 2.0.0 を使用しています

以下は、生成された膨大なログ レポートの一部です。

ETHON: started MULTI
ETHON:         performed EASY url= response_code=200 return_code=got_nothing total_time=2.663048
/Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/ethon-0.6.1/lib/ethon/multi/operations.rb:171: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
c:0091 p:---- s:0489 e:000488 CFUNC  :multi_perform
c:0090 p:0018 s:0484 e:000483 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/ethon-0.6.1/lib/ethon/multi/operations.rb:171
c:0089 p:0034 s:0479 e:000478 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/ethon-0.6.1/lib/ethon/multi/operations.rb:160
c:0088 p:0036 s:0474 e:000473 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/ethon-0.6.1/lib/ethon/multi/operations.rb:43
c:0087 p:0020 s:0470 e:000469 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.6/lib/typhoeus/hydra/runnable.rb:21
c:0086 p:0008 s:0466 e:000465 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/typhoeus-0.6.6/lib/typhoeus/hydra/memoizable.rb:51
c:0085 p:0104 s:0463 e:000462 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/firebase-0.1.4/lib/firebase/request.rb:50
c:0084 p:0019 s:0456 e:000455 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/firebase-0.1.4/lib/firebase/request.rb:20
c:0083 p:0019 s:0451 e:000450 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/firebase-0.1.4/lib/firebase.rb:34

.
.
.

c:0005 p:0027 s:0029 e:000028 METHOD /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/puma-2.6.0/lib/puma/server.rb:357
c:0004 p:0035 s:0022 e:000021 BLOCK  /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/puma-2.6.0/lib/puma/server.rb:250 [FINISH]
c:0003 p:---- s:0016 e:000015 CFUNC  :call
c:0002 p:0084 s:0011 e:000010 BLOCK  /Users/siddharthbhagwan/.rvm/gems/ruby-2.0.0-p247/gems/puma-2.6.0/lib/puma/thread_pool.rb:92 [FINISH]
c:0001 p:---- s:0002 e:000001 TOP    [FINISH]
.
.
.
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

クイックとは、1 秒あたり 1 回のクリックを意味します。これは、2 秒に 1 回のクリックなど、遅いクリックでは発生しません。

ループ内で irb から firebase にプッシュしても、このエラーは発生しません。

前もってありがとう、乾杯!

4

1 に答える 1

1

firebase-ruby gem を使用していますか? 本日、この問題のバグ修正を提出しました。次のように、gem で問題のあるメソッドをオーバーライドすることで、自分でホット パッチを適用できます。

モジュール Firebase

クラスリクエスト

def process(method, path, body=nil, query_options={})
  request = Typhoeus::Request.new(build_url(path),
                                  :body => body,
                                  :method => method,
                                  :params => query_options)
  response = request.run
  Firebase::Response.new(response)
end

終了 終了

または、プル リクエストが受け入れられるのを待ちます。問題は、ジェムが Typheous の Hydra を使用することにありました。

于 2014-06-20T18:37:59.360 に答える