LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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

Reply
 
Search this Thread
Old 03-30-2010, 11:09 AM   #1
robmoser
LQ Newbie
 
Registered: Mar 2010
Posts: 10

Rep: Reputation: 0
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.
Old 04-03-2010, 05:13 AM   #2
codedr
Member
 
Registered: Feb 2007
Location: USA
Distribution: opensuse, slackware
Posts: 35

Rep: Reputation: 17
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.
Old 04-05-2010, 10:54 AM   #3
robmoser
LQ Newbie
 
Registered: Mar 2010
Posts: 10

Original Poster
Rep: Reputation: 0
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.
 
Old 04-05-2010, 11:18 AM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,009
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
Quote:
Originally Posted by codedr View Post
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.
 
Old 09-05-2013, 11:02 AM   #5
jpv50
LQ Newbie
 
Registered: Sep 2013
Posts: 1

Rep: Reputation: Disabled
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.
  


Reply

Tags
locks


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 04:43 PM
Very large number of entries in /proc/locks kapeller Linux - Kernel 0 11-02-2009 03:25 AM
what is /proc/interrupts & /proc/irq/*/spurious mean? nesta Linux - Embedded & Single-board computer 2 06-16-2009 09:33 AM
Boot hang after 'proc on /proc type proc (rw)' Hagoromo Slackware 13 10-05-2007 05:03 PM
adding pci device ids to pci.ids xerxex Linux - General 0 01-18-2006 06:36 PM


All times are GMT -5. The time now is 07:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration