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 206513

Summary: Does not Save Files
Product: platform Reporter: gary_mazz
Component: TextAssignee: Miloslav Metelka <mmetelka>
Status: RESOLVED FIXED    
Severity: normal CC: ben2, caustin, dinamic, dstrupl, fredgarlov00, ianfp, jdbevan, jtulach, karols, leetravis7, mgoe, mmetelka, mmirilovic, pjiricka, tend626
Priority: P2    
Version: 7.0.1   
Hardware: Macintosh (x86)   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: Log file of possible occurrance
messages.log for netbeans 7.2
messages.log - dev-201210210002
messages.log - dev-201210210002; CloneableEditorSupport log level FINE
messages.log - dev-201210210002; CloneableEditorSupport log level FINE; part 1
relevant log files in zip file - no config flag set
Logs in zip file
Logs in zip file
logs in zip file with new log settings
logs in zip file with new log settings
Log files in zip form netbeans 7.3
Log messages with requested log levels switched on
Screen shot of the editor tab and toolbar
Screen shot 1
Screen shot 2
Own implementation of SaveAll actions which works.
Log messages with requested loggers switched on.

Description gary_mazz 2011-12-18 19:12:29 UTC
Created attachment 114292 [details]
Log file of possible occurrance

Saving edits to files do not get committed to disk. Current versions of the files remain in the buffers, but the save action has no effect on the files stored on disk. 

When netbeans is unloaded all edits in the buffer are lost. 

No error messages are displayed and the files appear to be saved in the IDE.

This type of defect makes the product unusable.
Comment 1 Miloslav Metelka 2012-02-23 14:47:12 UTC
Could you please test the problem in NB version 7.1 an possibly in a recent Dev build whether you get the same behavior? Thanks.
Does it happen for all the sources always or are there any specific steps to reproduce?
Comment 2 ben2 2012-03-09 11:37:30 UTC
I've just seen this bug as well... I've managed to get netbeans into the situation where I have a file open, but modifying it does not light up the save button. File > Save is greyed out. I can change the file - but not save it!

I sometimes work with a difftool (I use diffmerge) open on the file at the same time the file is open in the editor. (I find this useful when working with large files)  Is the problem something to do with NetBeans computing whether there are pending changes by examing modification timestamps? or is it keeping the file open between saves, and things are getting messed up if I externally modify the file?

I also use git - perhaps that is interfering somehow?

The problem is I was working away for ages - pressing Ctrl-S and going back to the browser - obviously unless you click or look at the save button you don't realise the file hasn't been saved. Even worse: close the file, and all the changes are gone - no prompt to save!!
Comment 3 ben2 2012-03-09 12:10:09 UTC
I can reproduce:

I have a project set up to upload changes to FTP on save. (SFTP actually)
Start diffmerge via a git difftool command (www.sourcegear.com/diffmerge/)
Start Netbeans
Open a file. 
Type something
Save button lights up. As expected.
Save. File uploaded. As expected. Save button greyed out. File > save, etc. greyed out.
Change file in diffmerge. Save.
Net beans uploads file. As expected.
No prompt to reload changes from disk. Would expect to see this.
Type some changes in file.
Save button does not light up. Ctrl-S not work. File > save greyed out. etc. Would expect to see this.
Close File. No prompt to save. Would expect to see this.

I haven't checked whether a modification with another program also causes the same issue.
Comment 4 ben2 2012-03-09 12:45:41 UTC
Just upgraded to 7.1.1 - seems fixed.
Comment 5 David Strupl 2012-03-09 14:31:37 UTC
Marking as works for me in 7.1.1. If you see this again please reopen. But please add additional details since the log file does not show anything suspicious.
Comment 6 ben2 2012-03-09 15:32:50 UTC
Since upgrading ealier today, it seemed fixed, but has just occured again, this time in 7.1.1
Comment 7 indomieplease 2012-03-12 21:36:23 UTC
I encountered the same bug. I do not use git, nor was I difftool-ing. My use case was pretty simple: Was writing a JUnit test file (original version was template-generated). I "saved", then ran the test. The test failed with complaints about variables that didn't even exist anymore in the source at this point. Did clean build, but that didn't help. I then restarted the IDE, and when it relaunched I noticed all my changes to the source code was gone.
Comment 8 Miloslav Metelka 2012-04-16 14:20:00 UTC
(In reply to comment #4)
> Just upgraded to 7.1.1 - seems fixed.

ben2 can you still reproduce by using the steps from you comment #3?
Comment 9 ben2 2012-04-19 08:31:34 UTC
Looks fixed in 7.1.1. If it happens again I'll reopen. Thanks.
Comment 10 Miloslav Metelka 2012-04-19 08:58:59 UTC
Ok, so marking as fixed for now.
Comment 11 dinamic 2012-10-18 13:02:58 UTC
This bug has bothered me for a while now. It appears out of the blue and I don't seem to be able to get a pattern to reproduce it.

I'm using Netbeans 7.2. Here my build info:

Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0._04; Java HotSpot(TM) Client VM 23.0-b21
System: Windows XP version 5.1 running on x86; Cp1251; en_US (nb)

I'm attaching also my messages.log file.
Comment 12 dinamic 2012-10-18 13:04:17 UTC
Created attachment 126140 [details]
messages.log for netbeans 7.2
Comment 13 gary_mazz 2012-10-18 13:56:59 UTC
I'll attempt 7.2 on XP in a few days.. and try to confirm the issue as been fixed.
Comment 14 Miloslav Metelka 2012-10-18 14:23:28 UTC
Issue #218679 should improve the situation regarding save - now there's a doc's write-lock throughout save actions and save itself. If possible please test on a Dev build that will include fix of issue #218679. Thanks.
Comment 15 dinamic 2012-10-23 09:14:36 UTC
I've noticed it is available. I'm on my way downloading it. Hope it's fixed.
Comment 16 dinamic 2012-10-23 11:39:16 UTC
Created attachment 126388 [details]
messages.log - dev-201210210002

I can confirm that the issue is still present in 201210210002 nightly.
Comment 17 dinamic 2012-10-24 08:16:34 UTC
It seems to me like the issue occurs more frequently.

I'm using the nightly build since yesterday morning and so far I was able to reproduce it more than five times. Thank God I'm writing a console util, so I'm executing it on regular basis and any malfunction of the IDE is noticed.
Comment 18 Miloslav Metelka 2012-10-24 09:40:08 UTC
Could you please run the IDE with

-J-Dorg.openide.text.CloneableEditorSupport.level=FINE

and attach the log file? That should track the saveDocument() calls. Thanks.
Comment 19 dinamic 2012-10-24 12:52:38 UTC
Created attachment 126468 [details]
messages.log - dev-201210210002; CloneableEditorSupport log level FINE

I've ran the application having the switch you mentioned and just reproduced the issue.

I'm attaching the messages.log file. I hope it's useful :)
Comment 20 dinamic 2012-10-24 12:55:46 UTC
Created attachment 126470 [details]
messages.log - dev-201210210002; CloneableEditorSupport log level FINE; part 1

I took a look at the previous log file I attached and it seem like this one is the first file which was rotated after reaching 1Mb of size.
Comment 21 Miloslav Metelka 2012-10-24 20:21:10 UTC
Besides an external reload:
FINE [org.openide.text.CloneableEditorSupport]: PROP_TIME new value: Wed Oct 24 15:49:39 EEST 2012, 1351082979281
FINE [org.openide.text.CloneableEditorSupport]:        lastSaveTime: Wed Oct 24 15:43:27 EEST 2012, 1351082607421
FINE [org.openide.text.CloneableEditorSupport]:              reload: true
FINE [org.openide.text.CloneableEditorSupport]: reload task posted
FINE [org.openide.text.CloneableEditorSupport]: checkReload starting
FINE [org.openide.text.CloneableEditorSupport]: checkReload noAsk: true
FINE [org.openide.text.CloneableEditorSupport]: reloadDocument in Thread[AWT-EventQueue-1,6,IDE Main]
FINE [org.openide.text.CloneableEditorSupport]: clearDocument
FINE [org.openide.text.CloneableEditorSupport]: Setting new lastSaveTime to 1351082979281
FINE [org.openide.text.CloneableEditorSupport]: post-reload task posting to AWT
FINE [org.openide.text.CloneableEditorSupport]: Posting the AWT runnable: org.openide.text.CloneableEditorSupport$8$2@ef7d7e
FINE [org.openide.text.CloneableEditorSupport]: Posted in Thread[AWT-EventQueue-1,6,IDE Main]
FINE [org.openide.text.CloneableEditorSupport]: task-discardAllEdits
FINE [org.openide.text.CloneableEditorSupport]: task-check already modified
FINE [org.openide.text.CloneableEditorSupport]: task-callNotifyUnmodified
FINE [org.openide.text.CloneableEditorSupport]

and several Lucene exceptions I don't see anything suspicious in the logs.
Were you aware of the external file reload (I'll modify the logging so that there's a fileobject name added)? Also we should possibly add a time in a normal format in addition to currentTimeMillis() so that you could compare whether the particular save occurred or not at that time.
Comment 22 dinamic 2012-10-25 06:14:45 UTC
After the issue occured, I've copied the content that should have been saved and placed it into the file using Notepad++ - perhaps this is the external modification you are noticing. I've closed NetBeans after and copied the message log.

Is there anything else I can do to help you isolate the problem?
Comment 23 Miloslav Metelka 2012-11-01 16:30:50 UTC
I have improved the logging support in CES:
http://hg.netbeans.org/jet-main/rev/2567cc74027b

Once the fix appears in a daily build (please note that it will not be part of upcoming beta2) could you please reproduce again with

-J-Dorg.openide.text.CloneableEditorSupport.level=FINE

and attach the log file? Please check (by comparing the save time in the output) whether the CES.saveDocument() was invoked for the problematic case or not. Thanks.
Comment 24 Quality Engineering 2012-11-02 03:31:20 UTC
Integrated into 'main-golden', will be available in build *201211020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2567cc74027b
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - added more detailed logging in CES.saveDocument().
Comment 25 dinamic 2012-11-06 10:58:41 UTC
I was trying to the past few days to reproduce the issue using the nightly you mentioned, but it's unfortunate that this version is unstable and I cannot get it work properly.

It brings the CPU to 100% upon start and after finish building my projects it fails to respond to any actions. Even the menu is not responding.
Comment 26 dinamic 2012-11-06 11:07:36 UTC
I've just noticed that the ticket is opened for a issue with WindowsXP running on Mac x86. I would like to point out that I'm running WindowsXP on PC.
Comment 27 Miloslav Metelka 2012-11-12 10:45:19 UTC
Not sure what's wrong with the builds but if 100% CPU persists please attach several thread dumps - http://wiki.netbeans.org/GenerateThreadDump or make a profiling snapshot - http://wiki.netbeans.org/FaqProfileMeNow

Anyway I'd like to have a log from build 201211020001 or later with -J-Dorg.openide.text.CloneableEditorSupport.level=FINE
since for me it's the only way we can move forward.
Comment 28 Quality Engineering 2012-11-15 02:44:41 UTC
Integrated into 'main-golden', will be available in build *201211150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2b4073efa613
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - added more detailed logging in CES.saveDocument().ction registration by the annotation doesn't work (PHP "comment" button stopped working in 7.3 beta 2).
Comment 29 Miloslav Metelka 2012-11-28 16:33:26 UTC
(In reply to comment #25)
> I was trying to the past few days to reproduce the issue using the nightly you
> mentioned, but it's unfortunate that this version is unstable and I cannot get
> it work properly.
> 
> It brings the CPU to 100% upon start and after finish building my projects it
> fails to respond to any actions. Even the menu is not responding.

Have you reproduced the problem with any of recent dev builds?
Comment 30 dinamic 2012-11-29 07:10:09 UTC
A few days back, I was able to reproduce it with 7.3 beta 2. Unfortunately, no additional logging was enabled. Since then I am using nightly 201211270002 and will post the message.log if I came up reproducing the issue.

Unfortunately, I don't have so much work regarding saving and utilizing a single file, so this might take a while.

The company is going to migrate to Windows 8 soon, so I hope I will be able to gather the data before that.
Comment 31 dinamic 2012-11-30 11:32:30 UTC
I was just able to reproduce it. Dunno what to do after?

Should I just close the IDE? Or just get the message.log file at the time of the issue without touching anything else?
Comment 32 dinamic 2012-11-30 11:40:23 UTC
It is currious to note that while clicking on other tabs and returning back to the stucked one, the indication has changed and the file is shown up as a saved one, although it is not. I've verified it by opening the file with another text editor and the content is different - the last 2-3 operations were not saved.
Comment 33 dinamic 2012-11-30 11:44:48 UTC
I have reviewed the log file and I am concerned about some private company data will be exposed if uploaded to public. Can I send you the data via some e-mail?

Also, I've backed up the whole log folder, as the uigestures might prove useful for reproducing the problem.
Comment 34 David Strupl 2012-11-30 13:42:37 UTC
Hello, the log files are extremely useful for being able to diagnose this problem. Unfortunately as Mila pointed out it would be best if the log is from build 201211150001 or later. Also if the log contains some private data - would it be possible to overwrite such data e.g. with XXXXX in the log and attach it here anyway? As we said without the logs we cannot move further. Thanks a lot for your effort in helping to diagnose the problem. Br, David
Comment 35 ritty 2012-12-19 20:43:37 UTC
Ugh, just lost a couple hours worth of work because of this. Thought I was saving, but wasn't. This is a MAJOR bug. Product will not be used while this bug exists.
Comment 36 mirtanvir 2012-12-19 21:16:43 UTC
It has happened to me as well. I think this bug gets triggered after a svn commit. I am not sure 100% sure though. I cloned a project from github, and committed to a local svn repo. Very dangerous issue.
Comment 37 dinamic 2012-12-20 07:19:00 UTC
David, the log files contain file names and folders of the target of different actions I've performed. I'm afraid that replacing them all with something like XXXXX would make the log file worthless.

The bug happened to me only by using Windows XP. Let the others confirm this, but I have not came upon it while using Windows 7.

It has to be something platform specific.

I am still keeping the log files, so if Miloslav provide me a private email address, I would gladly send him the whole log folder.
Comment 38 mustdobetter 2012-12-21 08:31:15 UTC
I can confirm I have also experienced this issue many times using NetBeans 7.2 for Mac (10.8.2). I agree this is a major bug, and has resulted in lost work on several occasions.
Comment 39 bht 2012-12-21 19:49:33 UTC
Created attachment 129631 [details]
relevant log files in zip file - no config flag set

Build 201212170919

Found this with an HTML file. Was just editing this file, perhaps switching tabs, previously having used files from favorites. The file is under svn control, but no svn actions were done during this session.

8:18 a.m. 22/12/2012
Had this 10 minutes ago. Last change of RegisterPanelVisit.html was Format the code. The file name in the tab was bold after that indicating that the change was recorded but the save keyboard and menu actions were not available. I can't remember whether I was able to execute the action before it became unavailable.

So I closed the file and did not get a warning. I re-opened the file and the format action was not saved which confirmed my suspicion.

There are multiple errors in the log such as:
INFO [DependenciesGraph]: A graph cycle detected when adding refered node Node[somepath/css/style.css] to node Node[somepath/fileNotSaved.html]
Comment 40 bht 2012-12-23 19:26:07 UTC
I filed issue 224184 where the opposite happens. Might be helpful.
Comment 41 ejsmont.artur 2013-01-01 23:30:21 UTC
Hi there

Just wanted to mention that it happens to me and i lost multiple hours because of this bug. Very scary stuff if files are not saved. I worked from home over the christmas period and it was a nightmare.

I am on mac 10.6.8 and netbeans 7.2 and editing mainly PHP files.

Issues gets much much worse when i work from home over vpn and use mapped nfs drive. It used to happen to me before but i thought it was just issue with my network now my college told me he had same issue with saving to local file. It seems that it gets worse as network latency increases. Try adding latency by some remote nfs mounts over the atlantic and you should be able to reproduce.

Now i am paranoid so i save files twice. I copy entire content, save, close the tab, open the file again, paste it in and save again. This sequence seems to force the save but im not sure if its 100% reliable, just seems to save it on the second try.

I would really appreciate if you can fix it for us. 

Thanks a lot
Comment 42 Miloslav Metelka 2013-01-08 17:19:14 UTC
(In reply to comment #39)
> 8:18 a.m. 22/12/2012
> Had this 10 minutes ago. Last change of RegisterPanelVisit.html was Format the
> code. The file name in the tab was bold after that indicating that the change
> was recorded but the save keyboard and menu actions were not available. I can't
> remember whether I was able to execute the action before it became unavailable.

 Are you sure that the file was marked as modified (name bold) but the Save action (in menu and toolbar) was disabled? This would indicate that the CloneableEditorSupport is modified but a SaveCookie (Savable) is not present. Jardo, don't you know what could be wrong?

 The "A graph cycle detected..." messages come from DependenciesGraph class in web.common but they should not be fatal and they should not affect the save.

 If possible please run the IDE with the two following options - they will both show typing modifications and things regarding loading and saving of files:

-J-Dorg.netbeans.editor.BaseDocument.level=FINE
-J-Dorg.openide.text.CloneableEditorSupport.level=FINE

Thanks.
Comment 43 Miloslav Metelka 2013-01-10 13:15:36 UTC
(In reply to comment #41)
> Hi there
> 
> Just wanted to mention that it happens to me and i lost multiple hours because
> of this bug. Very scary stuff if files are not saved. I worked from home over
> the christmas period and it was a nightmare.
> 
> I am on mac 10.6.8 and netbeans 7.2 and editing mainly PHP files.
> 

Could you please test with the two loggers

-J-Dorg.netbeans.editor.BaseDocument.level=FINE
-J-Dorg.openide.text.CloneableEditorSupport.level=FINE

and attach a messages.log file to the issue? Thanks.
Comment 44 bht 2013-01-18 09:01:52 UTC
Created attachment 130348 [details]
Logs in zip file

This time logging is configured as advised.

How this reproduced on my computer:

To slow down the computer:

- Started NetBeans with lower memory settings than usual to make it a bit slower
- started a Java program thar reads all directories and opens all zip files starting at C:/
- let Windows explorer search at C:\ all files for some string
- In NetBeans open an HTML file under SVN control
- Have some other Java files open in the editor
- Copy the HTML file to a favorites folder
- Open both files in the diff editor
- Leave the diff editor alone and switch back to the SVN controlled version
- Make quick changes in the HTML file under SVN control and save immediately
- Make some more changes [Alt+Shift+F] and save immediately [Ctrl+S]

The result is that the label on the editor tab is bold but the save menu action is disabled.

This is exactly the same scenario where I first discovered the issue.

One or two of the following seems to be important:

- The system must be so slow that it cannot keep up with the typing at all.
- A lot of I/O is happening in the background

Extreme conditions, really, but they seem to occur randomy even on systems with reasonable performance. If you can't slow your comuter down enough, just add more explorer searches.
Comment 45 David Strupl 2013-01-18 09:46:10 UTC
Hello, did you put in the logging options to the netbeans.conf or did you try to run with them from the command line? I don't see the options activated in the messages.log nor I can se the log entries in the log ... Thanks for spending your time trying to reproduce this .... but can you please try again with the options on? Best regards, David
Comment 46 bht 2013-01-18 16:40:05 UTC
Created attachment 130369 [details]
Logs in zip file

My apologies - uploaded wrong zip file
Comment 47 David Strupl 2013-01-18 17:54:50 UTC
Yes, this looks a way better! Do you happen to remember what was the file that you were not able to save when you produced the last log?
Comment 48 bht 2013-01-18 18:04:21 UTC
RegisterPanelVisit.html
Comment 49 David Strupl 2013-01-18 18:07:23 UTC
Thanks. I thought it was that one but wanted to make sure ... We will have a deeper look on Monday .... Thanks a lot, David
Comment 50 caustin 2013-01-21 20:28:16 UTC
I'm coming across the same situation. Running NetBeans 7.1.1, Windows XP. Open NetBeans. Perform an SVN update, my modified file's label turns blue (indicating modifications). When attempting to save changes, I notice the the file is "NOT" writing. The current version appears to remain in the buffers, but when I open the file with gVim, the file hasn't changed. I have to copy my current buffer into a new file to save off the new changes (!!! VERY FRUSTRATING !!!), I've been losing my work unknowingly! If I close the file in NetBeans all my work is gone! If I reopen, I get the old version. I then have to manually put back in my new work. For some reason, now the file will save when I perform a save. When making modifications the label turns a "bold-blue" color, then "blue". This is normal behavior I believe. But somewhere along the line, this functionality fails, and only remains "blue" and cannot perform any more writes. I believe this is a high priority bug that needs to be addressed ASAP. Unfortunately, I'm going to have to stop using NetBeans until this bug is fixed, there is too much risk involved with this one.
Comment 51 Miloslav Metelka 2013-01-22 12:02:23 UTC
I fully understand your complaints. We have analyzed the logs in attachment 130369 [details] and continue to search for the cause of the problem.
 The log says that:
1) There was a regular save (no special conditions like e.g. CloneableEditorSupport redirect).
2) After that there was a reformat after which there's no other save so I assume that it was the time when the problem occurred. I assume that it was like already described i.e. the document became modified (tab name turned bold) but save action was not enabled and document could be closed without saving.

Some code related notes:
1) The log shows that CES.setAlreadyModified(true) gets called normally during first modification of reformat after the save.
2) Bolding of tab name occurs in DataEditorSupport.messageHtmlName() which calls annotateName() with CES.isModified() which calls cesEnv().isModified() so that method apparently has to return true while a save cookie is probably not present on the DataObject (so the save action is disabled).

We continue to put Thread.sleep() on various places trying to reproduce the problem. We also consider what further logging we could put in place so that we better understand the conditions (again thanks for the logs with logging flags).
Comment 52 Miloslav Metelka 2013-01-22 17:02:25 UTC
Added some logging to CES and DataObject:
http://hg.netbeans.org/jet-main/rev/7edfd27472ea
Comment 53 Quality Engineering 2013-01-23 02:50:21 UTC
Integrated into 'main-golden', will be available in build *201301230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7edfd27472ea
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - added logging to CloneableEditorSupport and DataObject.
Comment 54 dinamic 2013-01-23 07:50:52 UTC
I came upon this bug in the latest nighly which was downloaded yesterday. I'm now using Windows 7, so I believe we can ignore the OS as a criteria for reproducing. I'm also using the latest JDK/JRE, so the issue is not with the Java version as well.

I'm downloading the nightly Miloslav mentioned now.
Comment 55 Miloslav Metelka 2013-01-23 11:06:41 UTC
I would like to ask people that can reproduce the problem to download daily build 201301230001 and try to reproduce the problem with all of the following loggers turned on:

-J-Dorg.netbeans.editor.BaseDocument.level=FINE
-J-Dorg.openide.text.CloneableEditorSupport.level=FINE
-J-Dorg.openide.text.DataEditorSupport.level=FINE
-J-Dorg.openide.loaders.DataObject.level=FINEST

Please attach the resulting log to the issue. Thanks.
Comment 56 bht 2013-01-23 21:41:41 UTC
The issue keeps reproducing nicely, although not every time.

I will attach log files of 2 sessions. In the first one, logs3.zip, there is much activity at the beginning where I could not reproduce it. The last save was unsuccessful after which I closed the IDE. In the second one, logs4.zip, there were less attempts before the failure - again I closed NetBeans after the unsuccessful save.

One additional observation which you may want to discuss with others is the following: To slow the system down, I run massive read-only I/O in 2 separate processes. One Java and one Windows Explorer. The effect of this I/O is that there is almost no CPU available for NetBeans. Why? Because these processes have top priority like NetBeans, and they fetch files DIRECTLY from the cache which eliminates the hardware latency typically associated with I/O. So that all translates into 100% CPU. On a single core slow computer, this is of course a disaster.

I get the effects of this often with only NetBeans doing any I/O. I mean massive I/O. Scanning, FileUtils.normalizeFile() etc.. Again the files come from the cache. Even if this I/O occurs in separate threads, no CPU is available for doing any work. Then there is the combination with the GUI thread needing small aounts of I/O which is even worse.

NetBeans developers react to my slowness reports with comments that the I/O on the computer is extremely slow, and they cannot do anything about it. I agree with this partially. The computer is slow. But not THAT slow. I can get fast I/O but not if I do it in the way NetBeans seems to need it. Since version 7.1.2, the effect of this has more than doubled. Computer speed has not advanced at that rate in less than a year.
Comment 57 bht 2013-01-23 21:43:32 UTC
Created attachment 130557 [details]
logs in zip file with new log settings
Comment 58 bht 2013-01-23 21:44:37 UTC
Created attachment 130558 [details]
logs in zip file with new log settings
Comment 59 Miloslav Metelka 2013-01-28 14:04:10 UTC
bht: thanks a lot for the logs. I've possibly found a culprit code in HtmlEditorSupport that I've fixed:
http://hg.netbeans.org/jet-main/rev/27951a7cac21

Please note that this is a fix for .html files ONLY.
A similar code is present in some other editor supports as well but before proceeding with all of them we would like to know whether this change would fix the problem for .html files. I've seen that you've almost always reproduced for an .html file so please just wait for the fix to propagate into Dev build and then test whether you're still able to reproduce the problem with .html in the Dev build or not. Thanks.
Comment 60 Marian Mirilovic 2013-01-28 14:54:24 UTC
*** Bug 225411 has been marked as a duplicate of this bug. ***
Comment 61 Quality Engineering 2013-01-30 03:41:54 UTC
Integrated into 'main-golden', will be available in build *201301300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/27951a7cac21
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - fixed HtmlEditorSupport.saveDocument().
Comment 62 bht 2013-01-30 19:04:24 UTC
I have tested Build 201301300001 under the same conditions as before - does not reproduce with an HTML file.
Comment 63 Miloslav Metelka 2013-01-31 19:50:21 UTC
Fixed remaining editor supports:
http://hg.netbeans.org/jet-main/rev/2280c9054f2d
Comment 64 Miloslav Metelka 2013-01-31 22:39:03 UTC
Integrated into release73:
27951a7cac21 transplanted to a70b0e92f196
2280c9054f2d transplanted to 7b6e4a9ac342
Comment 65 Quality Engineering 2013-02-02 02:35:54 UTC
Integrated into 'main-golden', will be available in build *201302020001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2280c9054f2d
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - fixed remaining editor supports (besides HTML).
Comment 66 Quality Engineering 2013-02-04 01:16:20 UTC
Integrated into 'releases', will be available in build *201302032200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/a70b0e92f196
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - fixed HtmlEditorSupport.saveDocument().
(transplanted from 27951a7cac21bea84d5be5172f1e73b2bb18af0b)
Comment 67 js_water 2013-02-05 20:07:56 UTC
I wonder if this is a duplicate of (or at least related to) 
https://netbeans.org/bugzilla/show_bug.cgi?id=208520

I posted this comment there:
I experienced this behavior (i.e., opening files, no saving is possible). 
The problem was associated with files in a subversion working directory and
when I removed the subversion plugin from the ide, the save capability
immediately returned upon restart of the ide.

It may be a similar issue (i.e., a versionin plugin failure) that is occurring here to cause the trouble.
Comment 68 Marian Mirilovic 2013-02-10 08:01:39 UTC
*** Bug 225862 has been marked as a duplicate of this bug. ***
Comment 69 dinamic 2013-02-13 10:12:07 UTC
I don't know if the issue is related, but the issue with not saving a file happened to me a few minutes ago.

The strange thing was that the filename was not bold, even tho I have made modifications to the file. I got suspicious and copied the content of the file to notepad, closed the file and re-opened it - only 3 lines of code have been saved, while the other >30 lines were not. It's a good thing I've copied the whole content to notepad before closing the file.

I'm not reopening the issue as I'm not sure whether my build should be the one with the fixed behavior. It's Netbeans 7.3 RC2, which got out a few days after this bug has been marked as fixed. I suppose the patch has been merged, but I'm not sure.
Comment 70 xxcger 2013-02-22 02:26:46 UTC
Using 7.2 on kubuntu 10.4. I have to say, this is a really really bad bug!! Lost my code a few times in this week! Really pissed! Using NetBeans for 4 years, and I think it's time to move on. What a joke!
Comment 71 Jiri Prox 2013-02-22 06:49:13 UTC
Restoring the status,
The issue is fixed in 7.3 (which was released yesterday!) not in 7.2
Comment 72 karols 2013-02-24 02:16:25 UTC
I switched yesterday to version 7.3 and as other people I lost a lot of work. The problem still exists (I have never had that on version 7.1.1).

After noticing the problem I updated java, reinstalled NetBeans IDE 7.3 (PHP), run it, created empty file (desktop.php) dropped it to the IDE, changed and saved the file successfully and after that I started to quickly click CTRL + S and ENTER alternately. I was doing it quickly so sometimes instead of clicking CTRL + S i was clicking only 's'. At some point the file stopped to save and the "Save" button (menu item) was disabled. 

I reproduced that after couple of seconds. I'm attaching logs and the file I used (part that was successfully saved). I believe the log files are small and can help. I used those flags in configuration: 

-J-Dorg.netbeans.editor.BaseDocument.level=FINE
-J-Dorg.openide.text.CloneableEditorSupport.level=FINE
-J-Dorg.openide.text.DataEditorSupport.level=FINE
-J-Dorg.openide.loaders.DataObject.level=FINEST
Comment 73 karols 2013-02-24 02:23:26 UTC
Created attachment 131791 [details]
Log files in zip form netbeans 7.3

Log files and partialy saved file before saving stopped to work. 

In previous description I forgot to mention that after this bug occures I can't save the file despite next modifications, but when reverting the file to the state after loading the file (with CTRL + Z) I can save the file!
Comment 74 yngveh 2013-02-24 14:12:15 UTC
I have the same problem.
Product Version: NetBeans IDE 7.3 RC2 (Build 201302050851)
Java: 1.7.0_13; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_13-b20
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
The program I'm changing is downloaded from a repository with restriction. Is that a problem?
Comment 75 Miloslav Metelka 2013-02-25 15:07:54 UTC
With NB 7.3:
- Did anyone reproduce the problem in anything else than .php files?
- It looks like Windows 7, 1.7.0_15 is also an affected platform. Did anyone reproduced on Mac with NB 7.3?

Updated bug's component to platform/text since this isn't (and wasn't) an error in editor module(s).
Comment 76 karols 2013-02-27 09:39:17 UTC
I was able to reproduce the bug with *.php and *.js files. I tried also with *.txt and *.cpp but I wasn't able to do that with those two. I haven't tried with other file types. I'm using the 7.3 PHP version on windows 7.

I don't know if it's connected but I can reproduce the same bug on NB 7.2.1 on Mac. Probably it's the same bug.
Comment 77 maxym 2013-03-03 14:48:58 UTC
I can confirm it happens in NB7.3 as well as development version. I remember it happened in some older released but I'm almost sure that 7.2 was free of this issue.

At some point, saving file is going to be not possible. File remains marked as changed (tabs, files tree). Save option is unavailable. Attempt of of using Save As, overwriting existing file ends up with 'Please select different name' request.

I'm using only php package so cannot confirm other filetypes. However I'm using GIT if it does matter. But no files were changed to fire up the issue.

The workaround is: 
- CTRL-a CTRL-c
- close document - strange it doesn't warns about unsaved changes
- re-open document
- CTRL-v 
- SAVE - it works at this point
Comment 78 maxym 2013-03-03 14:51:15 UTC
Forgot to mention: Win7 64bit
Comment 79 Miloslav Metelka 2013-03-05 09:16:27 UTC
GsfDataObject calls explicit DataObject.setModified(false) after CloneableEditorSupport.saveDocument() (finding CloneableOpenSupport and casting to CES that's probably why we did not find it in the original fix).

http://hg.netbeans.org/jet-main/rev/70c712325579
Comment 80 Quality Engineering 2013-03-06 01:53:51 UTC
Integrated into 'main-golden', will be available in build *201303052300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/70c712325579
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - fixed GsfDataObject.
Comment 81 Miloslav Metelka 2013-03-06 09:58:52 UTC
Everyone affected by the problem: could you please re-test the problem in Dev build 201303052300? Thanks.
Comment 82 Miloslav Metelka 2013-03-08 11:10:52 UTC
Marked as fixed.
If anyone still reproduces in Dev build 201303052300 or later (downloadable from http://bits.netbeans.org/download/trunk/nightly/latest/ ) please reopen the issue. Thanks.
Comment 83 tend626 2013-03-11 19:58:27 UTC
(In reply to comment #77)
> I can confirm it happens in NB7.3 as well as development version. I remember it
> happened in some older released but I'm almost sure that 7.2 was free of this
> issue.
> 
> At some point, saving file is going to be not possible. File remains marked as
> changed (tabs, files tree). Save option is unavailable. Attempt of of using
> Save As, overwriting existing file ends up with 'Please select different name'
> request.
> 
> I'm using only php package so cannot confirm other filetypes. However I'm using
> GIT if it does matter. But no files were changed to fire up the issue.
> 
> The workaround is: 
> - CTRL-a CTRL-c
> - close document - strange it doesn't warns about unsaved changes
> - re-open document
> - CTRL-v 
> - SAVE - it works at this point

Nice workaround, I was saving the file with a different name, deleting the old one and then renaming - which didn't always work...
Comment 84 tend626 2013-03-11 20:09:36 UTC
I use Netbeans 7.3 on windows 8 (64bit) and this is actually quite easy to reproduce.

All my files are stored on a samba server mounted on a local drive on a windows box I use. And although I use the same timeserver to time sync all the machines in the network, netbeans still complains sometimes that some files need to be reloaded (however that seems to be a different story). Anyway, to reproduce the bug in my env I do the following:

1) Make changes to a file and quickly save (works fine)
2) Make another quick change (write, delete a single character) and attempt a save (I'm in the habit of pressing a lots of ctrl+s)
3) At this time I get a:
   "Question" - File "..." was modified externally. Overwrite it?
   And this dialog box has two options: Yes / NO
4) However if I press Esc while the dialog box is still open (just to get rid of it mind you) the following happens:
   - the dialog box disappears
   - any attempts to save the file afterwards (ctrl+s) end up with the windows ding sound
   - the file/save option is disabled
   - any changes done to the file afterwards do not enable the file/save option or ctrl+s
   - the title of the file is still shown as bold in the file tabs (suggesting its changes are not saved)
Comment 85 Miloslav Metelka 2013-03-12 08:45:20 UTC
(In reply to comment #84)
> I use Netbeans 7.3 on windows 8 (64bit) and this is actually quite easy to
> reproduce.
> 
Let's not mix your problem which involves a reload dialog box with this issue - I've entered issue 227337 to track it.


Btw I'm still waiting if anyone can reproduce in Dev build 201303052300 or later (downloadable
from http://bits.netbeans.org/download/trunk/nightly/latest/ )
if not then it would indicate that the changeset http://hg.netbeans.org/main-golden/rev/70c712325579 fixed the issue.
Comment 86 Miloslav Metelka 2013-03-13 16:33:41 UTC
In release73 (for patch1):
7edfd27472ea transplanted to 2756e69e3d96
70c712325579 transplanted as 9112190b9f73
Comment 87 Quality Engineering 2013-03-14 21:17:22 UTC
Integrated into 'releases', will be available in build *201303141828* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/2756e69e3d96
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #206513 - Does not Save Files - added logging to CloneableEditorSupport and DataObject.
(transplanted from 7edfd27472ea1ae904e59ef0f2f7e3314902480e)
Comment 88 tend626 2013-03-14 22:48:40 UTC
(In reply to comment #85)
> (In reply to comment #84)
> > I use Netbeans 7.3 on windows 8 (64bit) and this is actually quite easy to
> > reproduce.
> > 
> Let's not mix your problem which involves a reload dialog box with this issue -
> I've entered issue 227337 to track it.
> 
> 
> Btw I'm still waiting if anyone can reproduce in Dev build 201303052300 or
> later (downloadable
> from http://bits.netbeans.org/download/trunk/nightly/latest/ )
> if not then it would indicate that the changeset
> http://hg.netbeans.org/main-golden/rev/70c712325579 fixed the issue.

I've tried it in "Build 201303132300" and the issue doesn't seem to be present anymore! Good work, thanks for that.
Comment 89 Miloslav Metelka 2013-03-19 09:36:02 UTC
(In reply to comment #88)
> I've tried it in "Build 201303132300" and the issue doesn't seem to be present
> anymore! Good work, thanks for that.
Thanks for the testing. So the issue is fixed both in Dev builds and NB 7.3 patch1.
Comment 90 Tomas Danek 2013-03-20 14:48:45 UTC
both fix and logging are present in release73. Verified.
Comment 91 jdbevan 2013-03-20 15:14:04 UTC
(In reply to comment #90)
> both fix and logging are present in release73. Verified.

Sorry, just to clarify, do I need to get the nightly Development build or just the main 7.3 download from http://netbeans.org/downloads/ in order to get this bug fix?
Comment 92 Marian Mirilovic 2013-03-20 15:48:16 UTC
(In reply to comment #91)
> Sorry, just to clarify, do I need to get the nightly Development build or just
> the main 7.3 download from http://netbeans.org/downloads/ in order to get this
> bug fix?

Wait for Patch 1 (7.3 will notify the availability of the patch on update center and you will need just agree with update) - to be released next week.
Comment 93 camilo3rd 2013-03-20 19:56:31 UTC
this bug still happens in 7.2.1
Comment 94 Marian Mirilovic 2013-03-20 20:33:13 UTC
We will not backport the fix into previous releases, please wait for NetBeans 7.3 Patch 1
Comment 95 pdchase83 2013-03-28 15:17:44 UTC
Hate to tell you, but this is still happening.  When I'm editing PHP, HTML, CSS, etc. documents, the "Save" option still remains grayed out.  I'm using 7.3, and I just did a check for updates, nothing available.  

Problem still occurring.
Comment 96 xxcger 2013-04-02 04:30:17 UTC
Still happened for c++ on linux. I'm using: 
netbeans-trunk-nightly-201303092300-cpp-linux.sh
Comment 97 dinamic 2013-04-03 06:32:53 UTC
How it is supposed to be present on a nightly from 9th of March?
It was fixed on 19th of March.

Please, have a common sense and read the comments before reopening.
Comment 98 mgoe 2013-05-22 15:43:25 UTC
In our application based on the Netbeans platform (version 7.3, all available patches applied) a modified text document from time to time reaches a state where the "Save" and "Save All" actions are disabled while the editor tab uses a bold font to indicate that the document has been changed and not saved yet. After some trials I was able to reproduce the problem with the log levels switched on as requested by Miloslav Metelka on 2013-01-23. Please find attached the log messages and a screen shot of the editor tab and toolbar showing the problem. When I try to close the editor is in this state I'm asked if I would like to save the file.

Best regards,
Martin
Comment 99 mgoe 2013-05-22 15:45:20 UTC
Created attachment 134752 [details]
Log messages with requested log levels switched on
Comment 100 mgoe 2013-05-22 15:48:24 UTC
Created attachment 134753 [details]
Screen shot of the editor tab and toolbar
Comment 101 Marian Mirilovic 2013-05-23 08:22:05 UTC
*** Bug 229916 has been marked as a duplicate of this bug. ***
Comment 102 Miloslav Metelka 2013-05-23 08:52:32 UTC
(In reply to comment #98)
> showing the problem. When I try to close the editor is in this state I'm asked
> if I would like to save the file.

Since you're asked to save the file this differs from the symptoms of this issue: file with changes closed silently leading to a dataloss.
Please file a new issue e.g. "Save and Save All actions disabled on file with changes". Thanks.
Comment 103 xxcger 2013-06-17 22:24:39 UTC
Sorry for not having common senses to download the most latest fixed version. Now I'm working with "netbeans-trunk-nightly-201304102301-cpp-linux.sh", which shall carry all fixes I suppose. 

Unfortunately, files still couldn't get saved. No warning or error messages popped up, except the tab becomes light blue, which now handily serves as a warning sign. I'll have to use other editors to save what were typed in the screen. To be fair, it didn't happen as frequent as before. But it did happen twice this week, and it's Tuesday today.
Comment 104 mgoe 2013-12-02 16:27:10 UTC
The problem still happens in an application based on the Netbeans platform (version 7.4, all patches applied). I will add the log messages with the requested loggers switched on as well as a screen shot of the editor tab and toolbar after I modified the edited document (TabAndToolbarAfterModification1.png).

In order to workaround the problem I tried to implement my own versions of the Save and SaveAll actions. I wasn't successful for the Save action but for the SaveAll action I was able to implement a replacement which works (see attachment SaveAllAction.java). My SaveAll action is properly enabled while the Save and SaveAll action supplied by the Netbeans platform is not enabled (TabAndToolbarAfterModification2.png).

To get notified about changes I registered my SaveAll action as change listener using: DataObject.getRegistry().addChangeListener(). I found out that the stateChanged() method is not called on the EDT. In order to fix this I implemented a Runnable which moved the update of the enabled state into the EDT. Perhaps are the problems with the Save action EDT violations as well.

Best regards,
Martin
Comment 105 mgoe 2013-12-02 16:30:41 UTC
Created attachment 142788 [details]
Screen shot 1

The screen shot shows the editor tab and toolbar (showing the Save and SaveAll actions supplied by the Netbeans platform) after the document has been modified.
Comment 106 mgoe 2013-12-02 16:32:07 UTC
Created attachment 142789 [details]
Screen shot 2

The screen shot shows the editor tab and toolbar (showing the Save and SaveAll actions supplied by the Netbeans platform as well as my own implementations on the right) after the document has been modified.
Comment 107 mgoe 2013-12-02 16:33:57 UTC
Created attachment 142790 [details]
Own implementation of SaveAll actions which works.
Comment 108 mgoe 2013-12-02 16:41:47 UTC
I forgot to mention that I'm using a 64-Bit Linux operating system with jdk 1.7.0.45:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Martin
Comment 109 mgoe 2013-12-02 16:46:11 UTC
Created attachment 142791 [details]
Log messages with requested loggers switched on.
Comment 110 Miloslav Metelka 2013-12-29 11:02:29 UTC
(In reply to mgoe from comment #104)
> The problem still happens in an application based on the Netbeans platform
> (version 7.4, all patches applied). I will add the log messages with the
> requested loggers switched on as well as a screen shot of the editor tab and
> toolbar after I modified the edited document
> (TabAndToolbarAfterModification1.png).
> 
> In order to workaround the problem I tried to implement my own versions of
> the Save and SaveAll actions. I wasn't successful for the Save action but
> for the SaveAll action I was able to implement a replacement which works
> (see attachment SaveAllAction.java). My SaveAll action is properly enabled
> while the Save and SaveAll action supplied by the Netbeans platform is not
> enabled (TabAndToolbarAfterModification2.png).
> 
> To get notified about changes I registered my SaveAll action as change
> listener using: DataObject.getRegistry().addChangeListener(). I found out
> that the stateChanged() method is not called on the EDT. In order to fix
> this I implemented a Runnable which moved the update of the enabled state
> into the EDT. Perhaps are the problems with the Save action EDT violations
> as well.
> 
> Best regards,
> Martin

Based on this comment I reassign to platform/actions since the platform.text side is working properly and the problem seems to be in save actions' enablement.
Comment 111 Jan Peska 2014-01-06 09:52:52 UTC
(In reply to Miloslav Metelka from comment #110)
> Based on this comment I reassign to platform/actions since the platform.text
> side is working properly and the problem seems to be in save actions'
> enablement.

Hi,

if I get it right current problem is just that save toolbar button is disabled? If it is so, I would say we should create a new issue because it is really confusing to read hundred previous comments which are not related to current problem.

CCing Mila to confirm my assumption.
Comment 112 Miloslav Metelka 2014-01-08 11:04:55 UTC
Not sure whether it's just a toolbar issue.
mgoe when the problem happens, if you click "File" menu in NB are the "Save" and "Save All" actions enabled or disabled?

Anyway I agree to file a new issue since it's a different problem than the original report was.
Comment 113 Jan Peska 2014-01-09 09:12:55 UTC
I've filled new issue #240143 for the problem described by Martin (mgoe) -> reassigning this issue back to Mila - probably just for closing it since the original problem is already fixed.
Comment 114 HarischandraPrasadTirumani 2016-02-12 09:22:00 UTC
I am facing the same issue with:
Product Version: NetBeans IDE 8.1 (Build 201510222201)
Java: 1.8.0_66; Java HotSpot(TM) 64-Bit Server VM 25.66-b17
Runtime: Java(TM) SE Runtime Environment 1.8.0_66-b17
System: Windows 7 version 6.1 running on amd64; Cp1252; en_IN (nb)

I faced this multiple times in the past few months. Could not identify exact steps. Suddenly it stops writing the file content to disk even though Save button disables once clicks on Save(or Ctrl +S).
Comment 115 sureshpisupati 2016-09-16 10:18:27 UTC
Hi,

We are trying to migrate our product which is built based on NetBeans libraries from NetBeans 7.0 to NetBeans 8.
At the high level the functionality of the product will be like: the changes made in the UI ( for example selecting the check box or selecting a value from drop down ) will be reflected in the xml file in the background. For this we are using StyledDocument and this we are doing using DataEditorSupport class.

Till NetBeans 7 this was working fine but when we migrated to NetBeans 8.1 we are facing issue. It is taking lot of time and not updating the changes.

Here is the snippet of the code:
private synchronized void update( String xmlData ) {

      try {
         StyledDocument document = this.openDocument();
         document.remove( 0, document.getLength() );
         document.insertString( 0, xmlData, null );
      }
      catch( BadLocationException ex ) {
         ex.printStackTrace();
      }
      catch( IOException e ) {
         e.printStackTrace();
      }
   }

and at openDocument() the application getting hanged.

Please help in resolving this issue.
Comment 116 dinamic 2016-09-16 16:26:26 UTC
sureshpisupati, what you are saying does not sound to be related to the problem that has been discussed in this thread. I really think all contributors in this ticket don't really care about something that is totally unrelated.

Please, find an appropriate information channel for finding relevant information to your case.