From: SourceForge.net <no...@so...> - 2010-12-30 09:08:53
|
Bugs item #3142482, was opened at 2010-12-23 08:36 Message generated for change (Comment added) made by shlomy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=3142482&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: editor core Group: None Status: Open Resolution: None Priority: 3 Private: No Submitted By: Shlomy Reinstein (shlomy) Assigned to: Matthieu Casanova (kpouer) Summary: Exception while saving a buffer Initial Comment: While saving a buffer, I got the following exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 16431 at org.gjt.sp.jedit.buffer.JEditBuffer.getLineText(JEditBuffer.java:517) at org.gjt.sp.jedit.buffer.JEditBuffer.getLineText(JEditBuffer.java:499) at org.gjt.sp.jedit.bufferio.BufferIORequest.write(BufferIORequest.java:364) at org.gjt.sp.jedit.bufferio.BufferAutosaveRequest.run(BufferAutosaveRequest.java:82) at org.gjt.sp.util.WorkThread.doRequest(WorkThread.java:216) at org.gjt.sp.util.WorkThread.doRequests(WorkThread.java:183) at org.gjt.sp.util.WorkThread.run(WorkThread.java:157) Additional information: This is a local text file with 16431 lines, which I've been maintaining for several years now. I don't recall ever having exceptions while saving it in the past. I frequently perform copy/paste/cut operations on the file, as well as undo/redo, which might have caused the problem. ---------------------------------------------------------------------- >Comment By: Shlomy Reinstein (shlomy) Date: 2010-12-30 11:08 Message: Another thing to note is that I received this shortly after saving a buffer. I find it strange the AutoSave saves the buffer shortly after I manually saved it, no? ---------------------------------------------------------------------- Comment By: Shlomy Reinstein (shlomy) Date: 2010-12-30 11:08 Message: I think it's better to do the locking. This change that you found was made more than 8 years ago. Since then, the performance must have changed greatly - both jEdit as an application, the JRE and the storage. If this lock really annoys users, we can maybe lock parts of a buffer - e.g. separate the buffer to 1MB blocks and protect each one separately. What do you think? ---------------------------------------------------------------------- Comment By: Kazutoshi Satoda (k_satoda) Date: 2010-12-30 10:49 Message: > However, if BufferAutosaveRequest locks the buffer, any modification to > the buffer is halt until the save complete; it must be anoying. Thus the > locking is not done: commented out from source code. FYI, I found the exact revision which did this. http://jedit.svn.sourceforge.net/jedit/?view=rev&rev=4050 Please see the diff of BufferIORequest.java and CHANGES.txt . ---------------------------------------------------------------------- Comment By: Kazutoshi Satoda (k_satoda) Date: 2010-12-23 08:58 Message: This happens because BufferAutosaveRequest doesn't lock the buffer while reading it. The exception is thrown when some lines were deleted while BufferAutosaveRequest is running. This means that the auto save file can be corrupted silently, when some lines were added, or edited without changing the number of lines. However, if BufferAutosaveRequest locks the buffer, any modification to the buffer is halt until the save complete; it must be anoying. Thus the locking is not done: commented out from source code. The right solution will be, locking the buffer in BufferAutosaveRequest, and abort the request with the lock if someone request a write lock of the buffer. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=3142482&group_id=588 |