Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-30-2010, 11:09 AM
|
#1
|
LQ Newbie
Registered: Mar 2010
Posts: 10
Rep:
|
duplicate ids in /proc/locks
Hi All,
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
2.6.18-164.11.1.el5xen (Xen release for virtualisation)
I'm trying to track down a problem with a utility that used to work and now hangs indefinitely. Since its hanging, I suspected a locking problem, and went to have a look for the process ids in /proc/locks; I get:
148: FLOCK ADVISORY WRITE 30279 ca:21:49153 0 EOF
148: -> FLOCK ADVISORY READ 30282 ca:21:49153 0 EOF
Now as near as I can tell this shouldn't be my problem, since the two ADVISORY locks - one READ and one WRITE - shouldn't conflict with one another. But I'd like to understand it all the same. I haven't been able to find any kind of definitive guide for the format of /proc/locks entries, but what I did find in the manuals specifically states:
"Each lock has its own line which starts with a unique number. "
Which is obviously not true; both of my lines start with the same number. Also, since most search engines don't seem to play nicely with symbols, I can't find any reference to what the "->" means. Can anyone explain? Or point me to a good reference?
Thanks much,
- rob.
|
|
|
Click here to see the post LQ members have rated as the most helpful post in this thread.
|
04-03-2010, 05:13 AM
|
#2
|
Member
Registered: Feb 2007
Location: USA
Distribution: opensuse, slackware
Posts: 35
Rep:
|
man 5 proc
As for your 'hanging process', I would use strace to find what resource it is trying to acquire or wait on.
strace -o /var/tmp/foo myProg
You may need to use -f, ymmv.
|
|
1 members found this post helpful.
|
04-05-2010, 10:54 AM
|
#3
|
LQ Newbie
Registered: Mar 2010
Posts: 10
Original Poster
Rep:
|
man 5 proc has this to say about /proc/locks:
Quote:
/proc/locks
This file shows current file locks (flock(2) and fcntl(2)) and leases (fcntl(2)).
|
...and thats it. Not exactly a fount of information about the format. (I of course followed up on the man pages for the system calls, but none of them say anything about the format of the locks file.)
But strace is a useful one that I hadn't used before - thanks for the pointer.
|
|
|
04-05-2010, 11:18 AM
|
#4
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
Quote:
Originally Posted by codedr
man 5 proc
|
Before suggesting "man" you might want to review the man page you're talking about yourself to see if it includes the answer. Typically what I do is point out that man has the answer then quote the section or part of the section. In this case man did not have the answer.
|
|
|
09-05-2013, 11:02 AM
|
#5
|
LQ Newbie
Registered: Sep 2013
Posts: 6
Rep: 
|
I'm replying to this because there is so little information about the format of /proc/locks
Your output clearly shows why you have deadlock, if only you knew how to read it.
148: FLOCK ADVISORY WRITE 30279 ca:21:49153 0 EOF
148: -> FLOCK ADVISORY READ 30282 ca:21:49153 0 EOF
The first line shows one lock (id. 148) held by process with pid 30279. This is a write lock.
The second line shows a process is waiting to acquire the lock. It's pid 30282 and the "->" shows it's waiting to acquire the lock. It wants a read lock.
You need to figure out why process 30279 is holding a write lock, blocking process 30282 which is waiting for a read lock.
I hope this is helpful to people searching for information on this subject.
|
|
2 members found this post helpful.
|
All times are GMT -5. The time now is 04:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|