Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push all bytes when reading from a file channel #50

Merged
merged 1 commit into from
Jan 30, 2021

Conversation

jodersky
Copy link
Member

The FileChannel API makes no gurantees that a single call to "transferTo" will actually transfer all bytes from the file. In particular, if the file is large, it is likely that the destination channel will not accept all bytes at once.

@jodersky
Copy link
Member Author

Note that the failure appears to be an issue of how mill handles dead symlinks in PathRefs. There's a fix on the way com-lihaoyi/mill#1082. Alternatively, all tests pass with an older version of mill (0.8.0) which however is incompatible with Scala 3.0.0-M2.

@jodersky
Copy link
Member Author

Tests now pass with the updated mill version

@lefou
Copy link
Member

lefou commented Jan 29, 2021

Can it be related to com-lihaoyi/mill#528 ? We concat some shell script with a jar content. This seem to fail for large (maybe > 100MB) jar files. Here's the code:

os.write(output, prependShellScript + lineSep)
os.write.append(output, os.read.inputStream(tmp))

tmp is the jar file.

@jodersky
Copy link
Member Author

jodersky commented Jan 29, 2021

That's definitely possible. The circumstance that caused be find this bug were in the context of serving a large ~300MB file from cask.

The FileChannel API makes no gurantees that a single call to
"transferTo" will actually transfer all bytes from the file. In
particular, if the file is large, it is likely that the desitnation
channel will not accept all bytes at once.
@lihaoyi lihaoyi merged commit e658e9d into com-lihaoyi:master Jan 30, 2021
@lefou lefou added this to the 0.7.3 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants