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 194937

Summary: Reload in target platform always starts a fresh test instance
Product: platform Reporter: gregersen <gregersen>
Component: Launchers&CLIAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal CC: dds.dhawal, jglick, mmirilovic
Priority: P1 Keywords: REGRESSION
Version: 7.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description gregersen 2011-02-01 07:25:01 UTC
When running a NB Platform app on Windows 7, trying to reload a module with the "reload in target platform" does not work in current dev builds. Instead, a new test-instance is always started from scratch. 

Steps to reproduce:

1. create new NB Platform app
2. add one module to the app
3. select "reload in target platform" menu item from the module (regardless if changes are made to the module sources)

It seems that the changes made to CliHandler in #193481 is what blocking module reloading right now. The issue is that the lock file in the suite project is now locked with NIO, which prevents the reload ant task from obtaining a RandomAccessFile, because of an IllegalAccessException, stating that a portion of the file is locked by another process.

I can't find a temporary workaround.
Comment 1 Jaroslav Tulach 2011-02-01 12:47:22 UTC
True, the lock file is not locked by NIO. I am not sure way shall that prevent creation of RandomAccessFile however. Btw. if the Ant task is trying to find out whether lock file is still "live", then it is now much easier: just find out if it can be locked - if so, it is not "live" anymore.
Comment 2 gregersen 2011-02-01 12:58:49 UTC
It's not an issue with Ant. The issue is that the CLIHandler in the new instance cannot read host and port information from the lock file (throws IllegalAccessException), thus preventing communication between the two instances causing reload in target platform to fail, and a new instance to fully start instead.
Comment 3 Jesse Glick 2011-02-01 13:11:29 UTC
Right, this has nothing to do with any special Ant code AFAIK; the reload target simply runs the NB launcher in the usual way, on the same userdir, but with "--reload something.jar" on the command line. I don't have a copy of W7 to reproduce with, but if true, it would mean that e.g.

 ...\bin\netbeans --userdir c:\running\user\dir --open c:\some\file

(i.e. what is run by the NB shell association) would also fail.
Comment 4 Jaroslav Tulach 2011-02-03 19:22:54 UTC
On windows, when a process has FileLock on some file, other processes cannot read it! Yields IOException("The process cannot access the file because another process has locked a portion of the file"). This is different than on Unix! I want to lock the file and still allow anyone to read it, how can I do it on windows?
Comment 5 Jaroslav Tulach 2011-02-03 20:19:26 UTC
Fixed in ergonomics#3364ee25de93


Btw. propagation of fixes from ergonomics is blocked by bug 195029 and until that one is fixed (really fixed, not just marked invalid), ergonomics changes are not going to propagate.
Comment 6 Quality Engineering 2011-02-09 06:05:58 UTC
Integrated into 'main-golden', will be available in build *201102090000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3364ee25de93
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #194937: Windows llocks are mandatory - they prevent reading of the locked region. Lock just a single byte outside of the file's actual length
Comment 7 Jaroslav Tulach 2011-02-16 16:05:45 UTC
*** Bug 195403 has been marked as a duplicate of this bug. ***
Comment 8 Chiana 2011-02-16 16:17:49 UTC
(In reply to comment #4)
> On windows, when a process has FileLock on some file, other processes cannot
> read it! Yields IOException("The process cannot access the file because another
> process has locked a portion of the file"). This is different than on Unix! I
> want to lock the file and still allow anyone to read it, how can I do it on
> windows?

That would be the DENYWRITE filemode... (0x20)
Comment 9 gregersen 2011-02-17 12:19:46 UTC
Was there any specific reasons not to include this fix in Beta 2?
Comment 10 Jaroslav Tulach 2011-02-17 12:48:41 UTC
No, I've just forgotten to do it. I can put it on some update center for beta2, if Marian tells me to do so.
Comment 11 Marian Mirilovic 2011-02-17 13:14:38 UTC
No plan to do any patch for Beta 2, wait for final build, or just use dailies. The quality of dailies is going to rise, the stabilization phase already started.
Comment 12 pekarna 2011-04-12 22:45:50 UTC
Pity this was not a sign of comming "Multiple IDE windows" feature, which is sometimes the reason of our devs choosing IDEA instead of NetBeans (when leaving Eclipse for good)...