rack

Rack throwing EOFError (bad content body)

拜拜、爱过 提交于 2019-12-30 09:09:11
问题 We're using Ruby 2.1.2, Rails 3.2.19 with JQuery 1.11, asset pipeline is not being used (so not using JQuery-ujs, but are using relevant rails.js explicitly). For most users, JQuery and other related common plugins are being pulled from Google CDN (including jquery.form 3.50). The web server affected is Ubuntu 14.04, Nginx 1.6, and Passenger 4.x. For about 10% of users on our production server (loads seem to not matter), we're getting a stack dump like this, primarily for one URL but there

Rack throwing EOFError (bad content body)

南笙酒味 提交于 2019-12-30 09:09:08
问题 We're using Ruby 2.1.2, Rails 3.2.19 with JQuery 1.11, asset pipeline is not being used (so not using JQuery-ujs, but are using relevant rails.js explicitly). For most users, JQuery and other related common plugins are being pulled from Google CDN (including jquery.form 3.50). The web server affected is Ubuntu 14.04, Nginx 1.6, and Passenger 4.x. For about 10% of users on our production server (loads seem to not matter), we're getting a stack dump like this, primarily for one URL but there

How can I pass SSL options into “rails server” in Rails 3.0?

徘徊边缘 提交于 2019-12-29 06:59:15
问题 Is there a way to pass SSL options into "rails server" (on Rails 3.0.0), using a custom Rack config or something similar? I'm trying to do two things: enable Cucumber to run tests that involve both secure and non-secure URL's, and make things simple for new developers, so they don't have to set up Apache and configure all the SSL/cert stuff before they can even write a line of code. On 2.3.8 we had a forked script/server that would start up a special WEBrick on a second port with all the

elasticsearch 集群分片分配,你需要知道的一些知识点

泄露秘密 提交于 2019-12-25 22:02:16
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 前言 前面我们学习过,master节点的职责有: 负责决定当前某个分片要分配到哪个节点上面。 在节点间移动分片,保证集群的平衡。等等。 分片分配-基于集群配置 分片分配是指将分片分配到某个主机节点上的一个过程。触发的场景有: 初始化恢复 分片副本分配 集群平衡 集群节点加入或者移除 分片的分配,对整个es集群有重要的影响,所以,如何熟悉控制它,是一个很重要的知识点。es集群提供设置集群允许分配那种类型的分片,包括所有分片(默认)、主分片、新索引的主分片、禁止所有索引分配分片。这几个选项。 可能你会觉得奇怪,禁止分片分配,那还怎么玩? 存在即是合理的,这个属性在运维集群(滚动重启、需要维护集群,推迟分片分配)的时候用处很大,比如,在手动关闭掉一个节点后,集群会在固定的一个时间窗口后发现节点的丢失,并且开始数据平衡,这个操作在多个数据量较大的分片上平衡是相当的耗时的,所以在这种情况下,可以在集群级别上,先禁止索引分配分片, 维护完毕后,再设置回来。 小结:在你知道节点会从故障中很快恢复回来的时候,可以使用它来推迟副本分片的移动。 index.unassigned.node_left.delayed_timeout 会让你的集群在触发重新分配前有时间去检测节点是否会重新加入。 延迟分配不会阻止副本被提拔为主分片

How to I specify that the protocol is https in a Rack::MockRequest?

走远了吗. 提交于 2019-12-25 06:32:00
问题 I want to set the protocol to https when making a request with Rack::MockRequest client = Rack::MockRequest.new(@app) #something like this? env = @app.env.merge("rack.url_scheme" => "https") response = client.get("/", env) How do I do it? Here are the Rack docs. 回答1: response = client.get("/", "rack.url_scheme" => "https") should work 来源: https://stackoverflow.com/questions/23603133/how-to-i-specify-that-the-protocol-is-https-in-a-rackmockrequest

Why does this rackup file work with Thin, but not WEBrick or Unicorn?

一世执手 提交于 2019-12-25 02:19:42
问题 I am having a strange issue running my static website locally (for testing). Both WEBrick and Unicorn are causing an assertion failure in Rack when navigating to root. However Thin works perfectly. My rackup file 'config.ru': # This is the root of our app @root = File.expand_path(File.dirname(__FILE__)) + '/site' default_charset = "; charset=UTF-8" run Proc.new { |env| # Extract the requested path from the request path = Rack::Utils.unescape(env['PATH_INFO']) index_file = @root + "#{path}

rack-rewrite remove slashes if not pattern

£可爱£侵袭症+ 提交于 2019-12-25 01:51:39
问题 I'm using rack-rewrite in my app to remove trailing slashes if found, but I only want that if not on a certain route. I've used something like: use Rack::Rewrite do r301 %r{^(?!testroute)(.+)/$}, '$1' end To achieve what I need (e.g. all routes but /testroute/ should have any trailing slashes removed). The issue is that even if it hits that specific route, it does not ignore it and it remove the trailing slashes. Is my regex wrong, or is there something that I am not considering? 回答1: Try

Why do I get a Nokogiri crash and MemoryError: negative re-allocation size?

。_饼干妹妹 提交于 2019-12-24 17:57:46
问题 I've got a crawler that runs fine locally, but when I run it on a XL EC2 instance, I'm getting a MemoryError: negative re-allocation size error. I've searched the web but can't find anything helpful. Any thoughts on what could be wrong? 回答1: I believe we were getting this error because of our disk was full. 来源: https://stackoverflow.com/questions/10838475/why-do-i-get-a-nokogiri-crash-and-memoryerror-negative-re-allocation-size

Why do I get a Nokogiri crash and MemoryError: negative re-allocation size?

荒凉一梦 提交于 2019-12-24 17:56:03
问题 I've got a crawler that runs fine locally, but when I run it on a XL EC2 instance, I'm getting a MemoryError: negative re-allocation size error. I've searched the web but can't find anything helpful. Any thoughts on what could be wrong? 回答1: I believe we were getting this error because of our disk was full. 来源: https://stackoverflow.com/questions/10838475/why-do-i-get-a-nokogiri-crash-and-memoryerror-negative-re-allocation-size

Rack::Deflater apparently gzip page but it appears as gibberish in browser

大憨熊 提交于 2019-12-24 08:51:16
问题 I've deployed a rails 3.1 app on the new cedar stack on heroku. The new stack doesn't automatically provide gzipping so I've added use Rack::Deflater in my config.ru Testing it through curl with the following command: curl -i -H 'Accept-Encoding: gzip,deflate' http://carbuzz-production.herokuapp.com Returns an header with content encoding gzip and a body that seems compressed. Opening the page in firefox or chrome shows the body untranslated (lots of gibberish). Any idea how to solve this?