unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Aakash Gupta <aakash.gupta96@outlook.com>
To: "unicorn-public@bogomips.org" <unicorn-public@bogomips.org>
Cc: "unicorn-public@bogomips.org" <unicorn-public@bogomips.org>
Subject: Re: Master Process Reaping Worker with No message
Date: Tue, 23 May 2017 19:29:08 +0000	[thread overview]
Message-ID: <BN6PR20MB128175467D808FF2D1EBB2679BF90@BN6PR20MB1281.namprd20.prod.outlook.com> (raw)

Thank a lot Eric. 
I am using Ruby 2.3.3 and Unicorn 5.3. 

"It sounds like somebody else is sending SIGKILL to a worker..." This line of yours saved my server. 

Actually when I uploads a file, it first goes to /tmp directory and then one of the worker processes of unicorn uploads it to S3 from there. So, earlier when I was trying to fix timeout connection error of unicorn, I increased it to 20 minutes and the problem was solved temporarily. 

But the problem was that the files that were uploaded temporarily to /tmp directory, those files do not get deleted from /tmp after they are uploaded to S3. So, I wrote a script using tmpreaper that cleans the /tmp directory recursively and removes the files that are 30 min older and added that to cron service. 

After this, as a result of this script, all the files that were required to be removed, were removed from /tmp directory but again a problem occurred. When I used "df -h" command to check whether the files are actually deleted or not, it showed that the space that was taken by uploaded files on my disk has not been freed :( . So, I searched internet and got to know that any other process was still using those files, that was why the space on the disk was not freed. 

I used ' lsof +L1 | grep "deleted" ' command and found that a process named 'bundle' is still using these deleted files. So, I again wrote a script that was killing the process that was using a deleted file.  Script was using this command

" lsof +L1 | grep 'deleted' | awk '{print $2}' | xargs kill -9 "

Today, after reading your words, I finally realised that my script was killing the unicorn worker itself because the command that I was using was killing the parent of "bundle" process. As "bundle" was a child of Unicorn worker, unicorn worker was being killed.

So, thanks a lot Eric :) 

I was finally able to solve this error because of the direction and hint that you gave me. But the only thing that I need to find is that what is causing uploaded files to persist in /tmp directory.   


             reply	other threads:[~2017-05-23 19:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 19:29 Aakash Gupta [this message]
2017-05-23 20:40 ` Master Process Reaping Worker with No message Eric Wong
  -- strict thread matches above, loose matches on Subject: below --
2017-05-23 13:20 Aakash Gupta
2017-05-23 16:22 ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR20MB128175467D808FF2D1EBB2679BF90@BN6PR20MB1281.namprd20.prod.outlook.com \
    --to=aakash.gupta96@outlook.com \
    --cc=unicorn-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).