-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-io
Description
File.openRead returns _FileStream which does not pause reading even if subscription to the stream is paused. See
Lines 61 to 75 in 4dd1522
| _controller = new StreamController<Uint8List>( | |
| sync: true, | |
| onListen: _start, | |
| onResume: _readBlock, | |
| onCancel: () { | |
| _unsubscribed = true; | |
| return _closeFile(); | |
| }, | |
| ); | |
| return _controller.stream.listen( | |
| onData, | |
| onError: onError, | |
| onDone: onDone, | |
| cancelOnError: cancelOnError, | |
| ); |
This means it does not respect the back-pressure. Consider the situation when you are piping a huge file into the socket (e.g. file.openRead().pipe(socket)) - the whole file will end up being buffered in memory because even though socket will pause once send buffer is full _FileStream will continue reading.
Metadata
Metadata
Assignees
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-io