Issue Details (XML | Word | Printable)

Key: HADOOP-4795
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Tsz Wo (Nicholas), SZE
Reporter: Tsz Wo (Nicholas), SZE
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Lease monitor may get into an infinite loop

Created: 06/Dec/08 12:25 AM   Updated: 08/Jul/09 04:43 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 0.18.3

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works 4795_20081205.patch 2008-12-06 02:37 AM Tsz Wo (Nicholas), SZE 4 kB
Text File Licensed for inclusion in ASF works 4795_20081208.patch 2008-12-08 06:10 PM Tsz Wo (Nicholas), SZE 4 kB
Text File Licensed for inclusion in ASF works 4795_20081209.patch 2008-12-09 08:54 PM Tsz Wo (Nicholas), SZE 5 kB
Text File Licensed for inclusion in ASF works 4795_20081209_0.18.patch 2008-12-09 09:17 PM Tsz Wo (Nicholas), SZE 5 kB
Text File Licensed for inclusion in ASF works 4795_20081209_0.19.patch 2008-12-11 01:07 AM Tsz Wo (Nicholas), SZE 5 kB
Java Source File Licensed for inclusion in ASF works TestLeaseMonitor.java 2008-12-09 10:49 PM Tsz Wo (Nicholas), SZE 5 kB
Issue Links:
Reference

Hadoop Flags: Reviewed
Resolution Date: 11/Dec/08 01:28 AM


 Description  « Hide
If a lease is not found in the namespace for some reasons (e.g. bugs), lease monitor may get into an infinite loop.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Tsz Wo (Nicholas), SZE added a comment - 06/Dec/08 12:49 AM
> lease is not found in the namespace for some reasons (e.g. bugs)

Let me clarify this: the file creation lease is in the system but the corresponding file is not found. This should not happen normally.


Tsz Wo (Nicholas), SZE added a comment - 06/Dec/08 02:37 AM
4795_20081205.patch: remove the lease if the corresponding INode is not found.

Tsz Wo (Nicholas), SZE made changes - 06/Dec/08 02:37 AM
Field Original Value New Value
Attachment 4795_20081205.patch [ 12395470 ]
Suresh Srinivas added a comment - 08/Dec/08 05:06 AM
In the method check(), if the older entry has not expired, we should break out of the while loop? Otherwise this code will cause a tight loop until sortedLease.size() becomes 0 in size?

Tsz Wo (Nicholas), SZE added a comment - 08/Dec/08 06:10 PM
> In the method check(), if the older entry has not expired, we should break out of the while loop?

You are right. I removed the "break;" in the original codes but forgot to add a "return;"

4795_20081208.patch: fix the bug above. Will try to add a test.


Tsz Wo (Nicholas), SZE made changes - 08/Dec/08 06:10 PM
Attachment 4795_20081208.patch [ 12395579 ]
Konstantin Shvachko added a comment - 08/Dec/08 10:28 PM
  1. I would rename Monitor.check() to something like checkLeases().
  2. esle statement can be removed.
  3. Wrapping String Collection into ArrayList can be replaced by collecting paths to be removed in an ArrayList and then removing them afterwards in a separate loop. This will be much less copying.

Tsz Wo (Nicholas), SZE made changes - 09/Dec/08 07:41 AM
Link This issue relates to HADOOP-4806 [ HADOOP-4806 ]
Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 08:54 PM
4795_20081209.patch: incorporated Konstantin's comments.

Tsz Wo (Nicholas), SZE made changes - 09/Dec/08 08:54 PM
Attachment 4795_20081209.patch [ 12395677 ]
Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 09:17 PM
4795_20081209_0.18.patch: for 0.18

Tsz Wo (Nicholas), SZE made changes - 09/Dec/08 09:17 PM
Attachment 4795_20081209_0.18.patch [ 12395680 ]
Tsz Wo (Nicholas), SZE added a comment - 09/Dec/08 10:49 PM
TestLeaseMonitor.java: This is a manual test for the infinite loop problem.

Tsz Wo (Nicholas), SZE made changes - 09/Dec/08 10:49 PM
Attachment TestLeaseMonitor.java [ 12395685 ]
Konstantin Shvachko added a comment - 09/Dec/08 11:12 PM
+1.
If the code in internalReleaseLease() below the new IOExceptions you introduced would throw an exception the data-structures may become inconsistent. But as I can see these exceptions are not thrown anywhere below under the conditions. We should commit this.
Another concern that existing images will contain FileUnderConstruction, which will unclosable forever, and therefore we should investigate how to convert them into real files in a separate jira.

Robert Chansler made changes - 09/Dec/08 11:20 PM
Link This issue is related to HADOOP-4814 [ HADOOP-4814 ]
Tsz Wo (Nicholas), SZE made changes - 10/Dec/08 10:03 PM
Assignee Tsz Wo (Nicholas), SZE [ szetszwo ]
Status Open [ 1 ] Patch Available [ 10002 ]
Hadoop Flags [Reviewed]
Tsz Wo (Nicholas), SZE added a comment - 10/Dec/08 10:33 PM
     [exec] -1 overall.  

     [exec]     +1 @author.  The patch does not contain any @author tags.

     [exec]     -1 tests included.  The patch doesn't appear to include any new or modified tests.
     [exec]                         Please justify why no tests are needed for this patch.

     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.

     [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.

     [exec]     +1 Eclipse classpath. The patch retains Eclipse classpath integrity.

Tested manually. No new tests added.


Tsz Wo (Nicholas), SZE added a comment - 11/Dec/08 12:42 AM
Tested locally, only org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.TestStartAtOffset failed. It does not seem related to this patch. Will file a issue I see it failing again.

Repository Revision Date User Message
ASF #725507 Thu Dec 11 00:50:15 UTC 2008 szetszwo HADOOP-4795. Prevent lease monitor getting into an infinite loop when leases and the namespace tree does not match. (szetszwo)
Files Changed
MODIFY /hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
MODIFY /hadoop/core/trunk/CHANGES.txt
MODIFY /hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Tsz Wo (Nicholas), SZE added a comment - 11/Dec/08 01:07 AM
4795_20081209_0.19.patch: for 0.19

Tsz Wo (Nicholas), SZE made changes - 11/Dec/08 01:07 AM
Attachment 4795_20081209_0.19.patch [ 12395783 ]
Repository Revision Date User Message
ASF #725519 Thu Dec 11 01:24:20 UTC 2008 szetszwo HADOOP-4795. Prevent lease monitor getting into an infinite loop when leases and the namespace tree does not match. (szetszwo)
Files Changed
MODIFY /hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
MODIFY /hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java
MODIFY /hadoop/core/branches/branch-0.19/CHANGES.txt

Repository Revision Date User Message
ASF #725521 Thu Dec 11 01:28:03 UTC 2008 szetszwo HADOOP-4795. Prevent lease monitor getting into an infinite loop when leases and the namespace tree does not match. (szetszwo)
Files Changed
MODIFY /hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
MODIFY /hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/LeaseManager.java
MODIFY /hadoop/core/branches/branch-0.18/CHANGES.txt

Tsz Wo (Nicholas), SZE added a comment - 11/Dec/08 01:28 AM
I just committed this.

Tsz Wo (Nicholas), SZE made changes - 11/Dec/08 01:28 AM
Resolution Fixed [ 1 ]
Status Patch Available [ 10002 ] Resolved [ 5 ]
Hudson added a comment - 11/Dec/08 02:19 PM
Integrated in Hadoop-trunk #685 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/685/)
. Prevent lease monitor getting into an infinite loop when leases and the namespace tree does not match. (szetszwo)

Tsz Wo (Nicholas), SZE made changes - 31/Dec/08 06:09 AM
Link This issue is related to HADOOP-4951 [ HADOOP-4951 ]
Nigel Daley made changes - 30/Jan/09 08:14 PM
Status Resolved [ 5 ] Closed [ 6 ]
Owen O'Malley made changes - 08/Jul/09 04:43 PM
Component/s dfs [ 12310710 ]