Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 2009 10:56:46 -0700
From:      "Antonio L." <antonio04@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Determining file on which process is trying to acquire lock / fbsd  7.1
Message-ID:  <d37f2aa10907111056u3d2ebb5cyac4e5cea53e6e082@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello!

I have a web server running nginx + php-fpm FreeBSD 7.1-RELEASE. When
traffic increases, the load doesn't go up noticeably, but I start getting
massive timeouts because the php-cgi processes stop responding.  In "top," I
see a whole bunch of these php-cgi processes in "lockf" state, so I assume
they're blocking while trying to acquire a lock on some file.

I tried using truss to see where this is occurring and get a lot of the
following:

# truss -p 77214
...
poll({10/POLLIN|POLLERR|POLLHUP},1,1000)         = 1 (0x1)
recvfrom(10,"STORED\r\n",8192,0x80,NULL,0x0)     = 8 (0x8)
close(10)                                        = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
fcntl(4,F_SETLKW,0x7fffffffc580)                 = 0 (0x0)
...
That last line is repeated about 20 times, then the process seems to get the
lock and go about its business, and then repeat.  There always seems to be a
pause in the truss output to my terminal after the
 "poll({10/POLLIN|POLLERR|POLLHUP},1,1000)" line as well.

Is there a way to determine which file the process is trying to set a lock
on? Or any other way to troubleshoot the cause of this problem?

I tried running "lsof -p 77214," which showed a long list of files used by
the process, but I didn't see anything about it trying to get a lock on a
file.  Googling suggests that "pfiles" on Solaris might help with this -- is
there an analogous utility on FreeBSD?

Thanks a lot in advance for any advice you might have!

Antonio



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d37f2aa10907111056u3d2ebb5cyac4e5cea53e6e082>