1
當我刷新websocket打開的頁面時,我在刷新的頁面上出現'內部服務器錯誤' 我找不到解決此問題的任何解決方案..我正在使用rails 4.1.8,websocket-rails gem,瘦服務器。頁面顯示頁面刷新後的內部服務器錯誤(使用websocket-rails)
,這是我的Rails日誌...
Unexpected error while processing request: deadlock; recursive locking
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/lock.rb:16:in `lock'
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/lock.rb:16:in `call'
/usr/local/share/gems/gems/actionpack-4.1.8/lib/action_dispatch/middleware/static.rb:84:in `call'
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/engine.rb:514:in `call'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/home/john/.gem/ruby/gems/faye-websocket-0.8.0/lib/faye/adapters/thin.rb:40:in `process'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/home/john/.gem/ruby/gems/faye-websocket-0.8.0/lib/faye/adapters/thin.rb:44:in `receive_data'
/home/john/.gem/ruby/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/home/john/.gem/ruby/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/home/john/.gem/ruby/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/usr/local/share/gems/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands/server.rb:69:in `start'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/usr/local/share/gems/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
這是我的客戶端代碼
<script>
var dispatcher_stock_table = new WebSocketRails($('.table').data('uri'), true);
dispatcher_stock_table.on_open = function() {
console.log('Connection has been established:');}
dispatcher_stock_table.on_close = function(closed) {
console.log('Connection has been closed:'+closed);}
var getvalues = function(value){
var valuenum = value.split('_')[1];
var data = {identity: valuenum,value: document.getElementById(value).value};
console.log(data);
var success = function(response) {
console.log("Wow it worked: "+response.message);
dispatcher_stock_table.unbind('stock_ajax_handler');
}
var failure = function(response) {
console.log("That just totally failed: "+response.message);
}
dispatcher_stock_table.trigger('stock_ajax_handler', data, success, failure);
function gettable(gettable_and_flashnotice) {
console.log(gettable_and_flashnotice.sent_data.notice);
dispatcher_stock_table.on_close("closed");
}
dispatcher_stock_table.bind('stock_ajax_handler', gettable);
// var channel = dispatcher.subscribe('<%=current_user.id%>');
// channel.trigger('notification_update',sent,success,failure);
// channel.bind('notification_update', function(data) {
// console.log('channel event received: ' + data);});
// channel.unbind('notification_update');
};
<script/>