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 - Dedlock in WritingQueue
Summary: Dedlock in WritingQueue
Status: RESOLVED WONTFIX
Alias: None
Product: cnd
Classification: Unclassified
Component: Remote (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-20 11:21 UTC by Vladimir Kvashin
Modified: 2012-05-04 11:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Full thread dump (41.81 KB, text/plain)
2012-04-20 11:21 UTC, Vladimir Kvashin
Details
proposed fix (2.26 KB, patch)
2012-04-20 12:51 UTC, Vladimir Kvashin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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