From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.229.226.196 with SMTP id ix4cs87829qcb; Wed, 28 Dec 2011 11:38:17 -0800 (PST) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncCJD_vfqXERCl4O33BBoEs7XQ_Q@googlegroups.com designates 10.52.172.178 as permitted sender) client-ip=10.52.172.178; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncCJD_vfqXERCl4O33BBoEs7XQ_Q@googlegroups.com designates 10.52.172.178 as permitted sender) smtp.mail=rack-devel+bncCJD_vfqXERCl4O33BBoEs7XQ_Q@googlegroups.com; dkim=pass header.i=rack-devel+bncCJD_vfqXERCl4O33BBoEs7XQ_Q@googlegroups.com Received: from mr.google.com ([10.52.172.178]) by 10.52.172.178 with SMTP id bd18mr13007325vdc.12.1325101095507 (num_hops = 1); Wed, 28 Dec 2011 11:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:mime-version:date:in-reply-to:references:user-agent :x-http-useragent:message-id:subject:from:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type :content-transfer-encoding; bh=5S4Ucq+XSMoVjM0x/oPZNpUrE2MVfSVG1vhk+xNSl9I=; b=ddgkK7NVfqxgFEyBiIuuFFPkkcmdAszkm1jjb2NRKai5DsIErBgG+OqvI+W2rgcXWi L8umHVNGw5XCFFQ1OS7EmHpRGsAM2PW2zyEeGX3XmlT4ygmnJsiM51FsmjqWbEiDGMuL hnh/xBpDXVM9OSvMZtf2pysXd9FEcWbu1tBbg= Received: by 10.52.172.178 with SMTP id bd18mr4139225vdc.12.1325101093031; Wed, 28 Dec 2011 11:38:13 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.220.149.19 with SMTP id r19ls11475930vcv.2.canary; Wed, 28 Dec 2011 11:38:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.15.230 with SMTP id a6mr4144504vdd.2.1325101092530; Wed, 28 Dec 2011 11:38:12 -0800 (PST) Received: by q11g2000vbq.googlegroups.com with HTTP; Wed, 28 Dec 2011 11:38:12 -0800 (PST) Date: Wed, 28 Dec 2011 11:38:12 -0800 (PST) In-Reply-To: <54F669AE-14FD-425A-B6CE-BBC4D893D5ED@gmail.com> References: <54F669AE-14FD-425A-B6CE-BBC4D893D5ED@gmail.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7,gzip(gfe) Message-ID: Subject: Re: Rack Application Initializes On Every Request From: Frank Ficnar To: Rack Development X-Original-Sender: frank.ficnar@gmail.com X-Original-Authentication-Results: ls.google.com; spf=pass (google.com: domain of frank.ficnar@gmail.com designates internal as permitted sender) smtp.mail=frank.ficnar@gmail.com; dkim=pass header.i=@gmail.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm not using Rack::Builder directly ... unless it's being used behind the scenes. I've got a config..ru as follows ... #\ --warn --port 8008 --pid ./rack.pid require 'rubygems' require 'bundler/setup' require 'rack' require 'ruby_app/rack/application' require 'ruby_app/rack/route' require 'ruby_app/version' use Rack::ShowExceptions use Rack::Session::Pool use Rack::Reloader use Rack::ContentLength map '/favicon.ico' do run Rack::File.new(File.join(RubyApp::ROOT, %w[resources favicon.ico])) end map '/ruby_app/resources' do run Rack::File.new(File.join(RubyApp::ROOT, %w[resources])) end map '/' do use RubyApp::Rack::Application run RubyApp::Rack::Route.new end ... where RubyApp is my middleware/application. During development the server is started via ... Rack::Server.start(:config =3D> '(path to config.ru)') It's the RubyApp::Rack::Application class that I've observed being initialized on every request. I haven't checked but I suspect the RubyApp::Rack::Route class is as well. Thanks for your help. Frank On Dec 28, 1:35=A0pm, James Tucker wrote: > Can you provide some more information? > > Rack doesn't instantiate anything itself. > > If you're using Rack::Builder, and you're talking about a middleware, the= n it's likely you forgot to call #to_app on the Builder instance before pas= sing it to the handler. > > On Dec 28, 2011, at 11:43 AM, Frank Ficnar wrote: > > > > > > > > > Is it normal that my 'initialize' method is called on every request to > > my Rack application (non-Rails)? > > > Rack' 1.3.5 didn't do this ... it started with the 1.4.0 update. > > > Frank