框架是 sinatra, 用的 puma 起的. 跑一段时间后会出现请求混乱的问题, controller 逻辑如下
def debug name, data
puts "-----#{name}"
puts data
end
def hello(params = {})
debug "----params", params
......
puts "----someting"
end
多次请求 http://localhost/controllers/hello?a=111&b=222 输出为
-----params
-----params
-----params
-----params
-----params
-----params
-----someting
{"a"=> "111", "b"=>"222"}
{"a"=> "111", "b"=>"222"}
{"a"=> "111", "b"=>"222"}
{"a"=> "111", "b"=>"222"}
{"a"=> "111", "b"=>"222"}
{"a"=> "111", "b"=>"222"}
其中"....."部分有数据库读写操作和 http 请求操作 之后报错
message type 0x54 arrived from server while idle
message type 0x44 arrived from server while idle
message type 0x43 arrived from server while idle
message type 0x5a arrived from server while idle
ActiveRecord::StatementInvalid - PG::UnableToSend: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"mobiles"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
:
在 model 进行 save 的时候卡住不动了。
C--C 后报错
^C- Gracefully stopping, waiting for requests to finish
^CThreadError - Attempt to unlock a mutex which is locked by another thread:
求解原因.....