Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

IO.copyFile fails with larger files on Windows #491

Closed
retronym opened this Issue Jun 25, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Owner

retronym commented Jun 25, 2012

java.io.IOException: Map failed
        at sun.nio.ch.FileChannelImpl.map(Unknown Source)
        at sun.nio.ch.FileChannelImpl.transferFromFileChannel(Unknown Source)
        at sun.nio.ch.FileChannelImpl.transferFrom(Unknown Source)
        at sbt.IO$$anonfun$copyFile$3$$anonfun$apply$3.apply(IO.scala:458)
        at sbt.IO$$anonfun$copyFile$3$$anonfun$apply$3.apply(IO.scala:457)
        at sbt.Using.apply(Using.scala:25)
        at sbt.IO$$anonfun$copyFile$3.apply(IO.scala:457)
        at sbt.IO$$anonfun$copyFile$3.apply(IO.scala:456)
        at sbt.Using.apply(Using.scala:25)
        at sbt.IO$.copyFile(IO.scala:456)
        at build$$anonfun$copyToUnmanagedJar$2.apply(build.scala:326)

Seems like:

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

Possible workaround:

http://dzone.com/snippets/java-filecopy-using-nio

Or by avoiding NIO on the Windows platform for file copying.

Owner

harrah commented Jun 30, 2012

Does the workaround work for you?

Owner

retronym commented Jun 30, 2012

We just used FileUtils.copyFile instead from Apache Commons IO rather than call the sbt copy function directly from our build. But we still hit this error intermittently when SBT internally used the NIO copy.

@harrah harrah closed this in b6b7861 Jul 6, 2012

Owner

harrah commented Jul 6, 2012

IO.copyFile now limits the maximum size transferred by one call to NIO. To verify on your system, io/test-only sbt.CopySpec for file sizes up to 256 MB. Change MaxFileSizeBits in CopySpec to test larger sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment