Skip to content

Instantly share code, notes, and snippets.

@raccy
Created July 2, 2016 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raccy/32706eab92cc07a077f2373d7626f80f to your computer and use it in GitHub Desktop.
Save raccy/32706eab92cc07a077f2373d7626f80f to your computer and use it in GitHub Desktop.
喫茶店シナトラでは珈琲を二杯同時に頼んではいけない

喫茶店シナトラでは珈琲を二杯同時に頼んではいけない

喫茶店シナトラで☕️を二杯同時に頼むとメイド(V8エンジン搭載)が固まります。

注文の仕方(再現方法)

あらかじめ Ruby 2.3.1 を rbenv とか使って入れておいて下さい。

bundle install --path vendor/bundle
bundle exec ruby app.rb

起動後、ブラウザで、http://localhost:4567/ にアクセスします。 何度か再起動とブラウザアクセスを繰り返していると、 Puma ごと固まって反応しなくなります。(10回に1回程度) 現象が発生すると、Ctrl+C で Puma を終了することができなくなり、 kill -KILL [pumaのpid]で終了させる必要があります。

頼むときの条件

therubyracerというメイド(V8エンジン搭載)に頼んで下さい。 Node.js組合からの派遣メイド(同じくV8エンジン搭載)に頼んでも、 そつなくこなしてくれるようです。 一杯ずつ注文した場合は駄メイドでも大丈夫のようです。

その他

  • Puma じゃなくて WEBrick でも発生するため、Web エンジンは関係無いようです。
  • 古いバージョンの Ruby は試していません。
  • 宝石(蛋白石)を二個注文した場合のことはわかりません。
  • バベルの塔を二基注文した場合のこともわかりません。
  • 🐧と🍎でのみ確認しています。窓でも起きるかどうかはわかりません。
  • therubyrhinoというメイド(Rhinoエンジン搭載)に頼んだ場合は未確認です。
# frozen_string_literal: true
require 'sinatra'
require 'execjs'
p ExecJS.runtime
set :views, '.'
get '/' do
slim :top
end
get '/first.js' do
coffee :first
end
get '/second.js' do
coffee :second
end
document.getElementById('first').textContent = 'First coffee!'
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'puma'
gem 'sinatra'
gem 'slim'
gem 'coffee-script'
gem 'therubyracer'
GEM
remote: https://rubygems.org/
specs:
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
execjs (2.7.0)
libv8 (3.16.14.15)
puma (3.4.0)
rack (1.6.4)
rack-protection (1.5.3)
rack
ref (2.0.0)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slim (3.0.7)
temple (~> 0.7.6)
tilt (>= 1.3.3, < 2.1)
temple (0.7.7)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
tilt (2.0.5)
PLATFORMS
ruby
DEPENDENCIES
coffee-script
puma
sinatra
slim
therubyracer
BUNDLED WITH
1.12.5
document.getElementById('second').textContent = 'Second coffee!'
doctype html
html
head
title Two cups of coffees in slim
body
p Order two cups of coffee ...
#first
#second
script src="/first.js"
script src="/second.js"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment