Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to set timeout using thin server
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ranc  
View profile  
 More options Feb 19 2012, 7:29 am
From: ranc <rancp...@gmail.com>
Date: Sun, 19 Feb 2012 04:29:38 -0800 (PST)
Local: Sun, Feb 19 2012 7:29 am
Subject: how to set timeout using thin server
hi,
  I've encounter a strange problem when running this:

get '/' do
  sleep 32
  'hello world'
end
  and problem is, the browser get nothing.
  the magic number 32, is searched by binary_search(-_-b), when it get
smaller, the browser works happy.

  Then I change the number to 60 and use tcpdump to check what
happens. It seems that Thin close connection about 30s after it
receive the request, then it log normally as if it send back the
response ..

  I can't find relative config about this timeout ..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ericgj  
View profile  
 More options Feb 20 2012, 11:59 pm
From: ericgj <ericg...@gmail.com>
Date: Mon, 20 Feb 2012 20:59:25 -0800 (PST)
Local: Mon, Feb 20 2012 11:59 pm
Subject: Re: how to set timeout using thin server
Not sure what you are trying to do, but Thin runs requests within an
EventMachine reactor thread, so sleep is not a good thing to do.. it
will block other requests too while sleeping.

If `sleep 32` is intended to represent a long-running task, you could
do something like

get '/' do
  EM.defer { sleep 32 }
  'hello world, waiting for task to end'
end

which offloads the task to a different thread. But this is for the
most simplistic cases - in most cases you want to send a response
during/after the long-running task. In those cases the Sinatra stream
helper is your best bet.

get '/' do
  stream do |out|
   11.times do |i|
     sleep(2)
     out << 'hello world'[i]
   end
  end
end

On Feb 19, 7:29 am, ranc <rancp...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Gorsuch  
View profile  
 More options Feb 19 2012, 4:15 pm
From: Michael Gorsuch <michael.gors...@gmail.com>
Date: Sun, 19 Feb 2012 15:15:53 -0600
Local: Sun, Feb 19 2012 4:15 pm
Subject: Re: how to set timeout using thin server
Hello -

I was able to put a sample project together witnessing this timeout
and also demonstrating a work around.

https://github.com/gorsuch/thin-timeout-example

Let me know if the README is not sufficient.  I haven't jumped into
the sinatra codebase to see if there is a better way around this, but
this might work for you.

Best,

Michael Gorsuch


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ranc  
View profile  
 More options Feb 19 2012, 11:58 pm
From: ranc <rancp...@gmail.com>
Date: Sun, 19 Feb 2012 20:58:00 -0800 (PST)
Subject: Re: how to set timeout using thin server
Sorry to bother, but it's solved now  ;)
I employ thin server directly rather than start the application with
"ruby myapp.rb".
The configure of thin server allows to set the server timeout, and
execution start point of ruby script(myapp.rb in this case).

If sinatra provide the configure of server timeout, things will be
easier, though

On Feb 19, 8:29 pm, ranc <rancp...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carl Hörberg  
View profile  
 More options Feb 19 2012, 3:26 pm
From: Carl Hörberg <carl.hoerb...@gmail.com>
Date: Sun, 19 Feb 2012 21:26:52 +0100
Local: Sun, Feb 19 2012 3:26 pm
Subject: Re: how to set timeout using thin server
thin is evented, you should never ever pause it's event loop, the
server will not be able to server other requests while it's paused.
That said you can change the timeout with the -t flag eg:

thin -t 60

default timeout is 30 seconds.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »