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 209720 - Locked by DB IO Exception
Summary: Locked by DB IO Exception
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: SQL Editor (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2012-03-19 08:47 UTC by pragalathan
Modified: 2012-09-25 02:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 186000


Attachments
stacktrace (785 bytes, text/plain)
2012-03-19 08:47 UTC, pragalathan
Details
proposed patch v1 (6.42 KB, patch)
2012-06-16 12:00 UTC, matthias42
Details | Diff
stacktrace (785 bytes, text/plain)
2012-06-26 11:29 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pragalathan 2012-03-19 08:47:50 UTC
Build: NetBeans IDE Dev (Build 201203180400)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.5-b03, Java(TM) SE Runtime Environment, 1.6.0_30-b12
OS: Linux

User Comments:
pragalathan: SQL query editor is opened and I was about to execute an SQL




Stacktrace: 
java.lang.Throwable: Locked by:
   at org.openide.filesystems.FileLock.<init>(FileLock.java:85)
   at org.openide.filesystems.MultiFileObject$MfLock.<init>(MultiFileObject.java:1681)
   at org.openide.filesystems.MultiFileObject.lock(MultiFileObject.java:712)
   at org.openide.filesystems.FileObject.getOutputStream(FileObject.java:732)
   at org.netbeans.modules.db.sql.history.SQLHistoryManager.save(SQLHistoryManager.java:155)
   at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:153)
Comment 1 pragalathan 2012-03-19 08:47:52 UTC
Created attachment 116851 [details]
stacktrace
Comment 2 Exceptions Reporter 2012-06-14 22:22:49 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=186000
Comment 3 matthias42 2012-06-16 12:00:58 UTC
Created attachment 120934 [details]
proposed patch v1

The attached patch moves saving into a seperate task that is invoked with a delay of 5 seconds. As save is called anytime an sql is executed, this should save some performance.
The task implicitly serializes saving and so locking problems should be minimized.
To prevent data loss on jvm shutdown a shutdown hook is added, that checks whether there are unsave changes and flushes these out.
Comment 4 Exceptions Reporter 2012-06-26 11:29:06 UTC
Created attachment 121356 [details]
stacktrace

Clicked on View Data in the DB table context menu.
Comment 5 Jaroslav Havlin 2012-09-24 13:44:52 UTC
Thank you very much. Great job, Matthias.
I've only slightly modified the test case, because Thread.sleep can cause problems when the tests are run on a Hudson builder.
Integrated as http://hg.netbeans.org/core-main/rev/13832fcf1769
Comment 6 Quality Engineering 2012-09-25 02:18:07 UTC
Integrated into 'main-golden', will be available in build *201209250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/13832fcf1769
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #209720: Locked by DB IO Exception