qorelanguage / qore

Qore Programming Language
GNU General Public License v2.0
61 stars 10 forks source link

file read timeouts don't work in Windows #3060

Open omusil24 opened 6 years ago

omusil24 commented 6 years ago
string txt;
try {
    txt += stdin.read(1, 100); # never actually timeouts
}
catch (ex) {
    stderr.printf("exception: %N\n", ex);
}

Possibly timeouts in other places/functionalities might not be working too.

Found in Windows 0.8.13.7 release downloaded from here: https://github.com/qorelanguage/qore/releases/download/release-0.8.13.7/qore-0.8.13.7-windows.zip

pvanek commented 6 years ago

internal note: possible showstopper for trainings on windows

davidnich commented 6 years ago

Asynchronous I/O is not implemented for files on Windows in Qore because it's not possible to use select() or poll() (WSAPoll()) on files on Windows

davidnich commented 6 years ago

I have been looking at this for quite a while, and it looks like it's not possible to do async I/O on stdin in any case on Windows: https://sourceforge.net/p/asio/mailman/message/19541146/

I tried it with I/O completion ports, but there is no way to set the stdin handle to asynchronous, and both ReadFile() and ReadFileEx() block even if you pass the OVERLAPPED ptr for async I/O.

If this is causing problems with the astparser module on Windows, let's try to find another solution - for example, if we can use sockets somehow, async socket I/O works fine on Windows.

omusil24 commented 6 years ago

It's not causing problems with astparser module. But it would be good to mention this in the documentation, that the timeouts/async IO don't work in Windows.

davidnich commented 6 years ago

docs need to be updated