yahns Ruby server user/dev discussion
 help / color / Atom feed
* [PATCH 0/2] shutdown stuff
@ 2018-12-30  2:33 Eric Wong
  2018-12-30  2:33 ` [PATCH 1/2] server: respect shutdown_timeout Eric Wong
  2018-12-30  2:33 ` [PATCH 2/2] server: extra shutdown timeout debugging Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2018-12-30  2:33 UTC (permalink / raw)
  To: yahns-public

Graceful shutdown is still a bit tricky...

Eric Wong (2):
      server: respect shutdown_timeout
      server: extra shutdown timeout debugging

 lib/yahns/server.rb | 13 +++++++++++++
 1 file changed, 13 insertions(+)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] server: respect shutdown_timeout
  2018-12-30  2:33 [PATCH 0/2] shutdown stuff Eric Wong
@ 2018-12-30  2:33 ` Eric Wong
  2018-12-30  2:33 ` [PATCH 2/2] server: extra shutdown timeout debugging Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2018-12-30  2:33 UTC (permalink / raw)
  To: yahns-public

It seems there is still a bug in the proxy code which causes
this timeout expiries to be missed.
---
 lib/yahns/server.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 583fd38..128b894 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -500,6 +500,8 @@ def dropping(fdmap)
     if drop_acceptors[0] || fdmap.size > 0
       timeout = @shutdown_expire < Yahns.now ? -1 : @shutdown_timeout
       n = fdmap.desperate_expire(timeout)
+      return false if timeout == -1
+
       $0 = "yahns quitting, #{n} FD(s) remain"
       true
     else
-- 
EW


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] server: extra shutdown timeout debugging
  2018-12-30  2:33 [PATCH 0/2] shutdown stuff Eric Wong
  2018-12-30  2:33 ` [PATCH 1/2] server: respect shutdown_timeout Eric Wong
@ 2018-12-30  2:33 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2018-12-30  2:33 UTC (permalink / raw)
  To: yahns-public

Still not sure what's going on with the proxy_pass code,
but something in the Fdmap code is causing shutdowns to
take way longer than expected...
---
 lib/yahns/server.rb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 128b894..2ad65a9 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -500,7 +500,18 @@ def dropping(fdmap)
     if drop_acceptors[0] || fdmap.size > 0
       timeout = @shutdown_expire < Yahns.now ? -1 : @shutdown_timeout
       n = fdmap.desperate_expire(timeout)
-      return false if timeout == -1
+      return false if n == 0 # all done!
+
+      # FIXME: sometimes shutdowns take a long time when using proxy_pass
+      # Still not sure what's going on and it takes a while to reproduce..
+      if timeout == -1
+        @logger.error(
+"exiting on shutdown_timeout=#@shutdown_timeout #{fdmap.size} FD(s) remain"
+        )
+
+        system('lsof', '-n', '-p', "#$$") if RUBY_PLATFORM =~ /linux/
+        return false
+      end
 
       $0 = "yahns quitting, #{n} FD(s) remain"
       true
-- 
EW


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-30  2:33 [PATCH 0/2] shutdown stuff Eric Wong
2018-12-30  2:33 ` [PATCH 1/2] server: respect shutdown_timeout Eric Wong
2018-12-30  2:33 ` [PATCH 2/2] server: extra shutdown timeout debugging Eric Wong

yahns Ruby server user/dev discussion

Archives are clonable:
	git clone --mirror https://yhbt.net/yahns-public
	git clone --mirror http://ou63pmih66umazou.onion/yahns-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.yahns

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox