vibe-d / eventcore

High performance proactor event loop abstraction library
MIT License
60 stars 42 forks source link

implement IOMode.once in posix file read #227

Closed WebFreak001 closed 9 months ago

s-ludwig commented 9 months ago

Wouldn't a simple test case that doesn't use up the whole memory resources of the test machine look something like this:

I don't know whether the amount of physical RAM is also a hard limit on some systems, but I would have guessed that it shouldn't matter when there is additional swap memory.

WebFreak001 commented 9 months ago

already without this change a small file with a bigger buffer would end there. This change makes it so that when the buffer is larger than what a single read call will fill, it will stop there and not attempt to read the rest of the file or fill up the buffer, like it does with IOMode.all

s-ludwig commented 9 months ago

already without this change a small file with a bigger buffer would end there

As far as I can see, this would result in IOStatus.error instead of IOStatus.ok, even if IOMode.once is specified.

This change makes it so that when the buffer is larger than what a single read call will fill, it will stop there and not attempt to read the rest of the file or fill up the buffer

And I think the only realistic condition for this is that EOF is hit before the buffer has been filled completely. Maybe there is some system memory dependence that can also trigger this, but at least I couldn't find any hint of such a thing. But regardless, a test that tries to use machine limits in a CI worker with likely multiple other CI jobs running in parallel is probably not a stable solution.

WebFreak001 commented 9 months ago

had this originally for reading from stdin, but decided to implement a separate stdin system now, because on windows it's like a file and on posix it's like a pipe - this didn't turn out to be used there