This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 211508

Summary: Dedlock in WritingQueue
Product: cnd Reporter: Vladimir Kvashin <vkvashin>
Component: RemoteAssignee: Vladimir Kvashin <vkvashin>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 7.0.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Full thread dump
proposed fix

Description Vladimir Kvashin 2012-04-20 11:21:37 UTC
Created attachment 118565 [details]
Full thread dump

There is a deadlockin WritingQueue / RemoteDirectory interaction.

The attached thread dump shows the following:

1) WritingQueue$Entry.taskFinished(WritingQueue.java:246) calls RemoteDirectory.updateStat, which waits for RemoteDirectory.lock.
This occurs in SFTP thread.

2). In other thread (in which a refresh on this directory is called)
RemoteDirectory.refreshDirectoryStorage(RemoteDirectory.java:459)
lock RemoteDirectory.lock and waits until SFTP finishes ls command.

But the amount of SFTP threads is limited;
and in full thread dump attached they all wait for this directory lock.

Fortunately we got rid of WritingQueue in 7.2,
so this can happen only on 7.0*, 7.1*
Comment 1 Vladimir Kvashin 2012-04-20 11:31:34 UTC
I forgot to mention that WritingQueue$Entry.taskFinished holds WritingQueue.lock, which has a single instance per file system
Comment 2 Vladimir Kvashin 2012-04-20 12:51:37 UTC
Created attachment 118568 [details]
proposed fix
Comment 3 Vladimir Kvashin 2012-04-23 08:26:16 UTC
It has already gone in 7.2

The situation I got this deadlock was kind of weird: there was a code (in Blacktie plugin) that invoked refresh on remote file system in FileOwnerQuery implementation (so it could be called hundreds time per second)

I have a fix that looks simple; however it concerns synchronization, which means it needs serious testing. So I guess it's too late to include it into 7.1.2 patch
Comment 4 Vladimir Kvashin 2012-05-04 11:11:09 UTC
Fixed in 7.2, doesn't make sense to fix in pre-7.2