On Windows, we sometimes get an error popup saying “Requested operation could not be performed on a file with a user-mapped section open.”

Can be reproduced by opening MyLang.sdf. Editing, saving. Opening Common.sdf. Editing, saving. Repeat.

(Related to Spoofax/83.)

Submitted by Lennart Kats on 28 April 2010 at 22:40

On 29 April 2010 at 10:06 Lennart Kats commented:

For now, as a workaround in, the I disabled the SDF editor’s support for content completion of sorts in other files. Seems to work.

[edit]Apparently, it doesn’t always work. One student reported that just rebuilding the project one or more times might help.[/edit]

On 29 April 2010 at 16:46 Lennart Kats commented:

Fixed in (until someone says its not). With some luck this also fixes a memory leak, since apparently I had to clean up after NIO and close some file handle it opened.

On 29 April 2010 at 17:17 Lennart Kats commented:

Someone said it’s not fixed. May be something else dealing with NIO.

On 2 May 2010 at 11:23 Lennart Kats commented:

Looks like these problems may be caused by using memory-mapped IO for reading files before parsing them:

  • http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154
  • http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4831749
  • http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4469299

The bugs above are filed as open or wontfix. Workaround:

"Don't do FileChannel.map() if other file operations are planned on the file, such as File.delete(). Instead, do FileChannel.read()."

On 3 May 2010 at 17:03 Lennart Kats commented:

I eliminated all uses of memory-mapped IO in 0.4.5, hopefully fixing this issue.

Log in to post comments