FileSystemException: An async operation is currently pending, path = '/dev/urandom'

817 views
Skip to first unread message

Anders Holmgren

unread,
Nov 3, 2014, 5:53:35 AM11/3/14
to mi...@dartlang.org
Getting this when using the oauth (oauth1 that is) package. I believe it emanates from the utis.dart file


    if(_randomFile == null) {

     _randomFile = new File("/dev/urandom").openSync();

   }

   return _randomFile.read(count);



It happens when I am making concurrent requests using the package. 

I can't see anything obviously wrong with this code but I'm unfamiliar with /dev/urandom. 

Anyone have any ideas as to what the issue might be?

A

Anders Holmgren

unread,
Nov 3, 2014, 3:04:33 PM11/3/14
to mi...@dartlang.org
So this seems to just be a limitation of RandomAccessFile. You can't do concurrent reads on the same instance of RAF. Simple program to reproduce

main() {
 
final f = new File("./delme.dart").openSync();

  f
.read(100);
  f
.read(100);
}

This results in the same error for me (dart 1.8.0-dev.2)

The following doesn't result in this error


main() {
 
new File("./delme.dart").open().then((raf) => raf.read(100));
 
new File("./delme.dart").open().then((raf) => raf.read(100));
}

AFAICT this limitation is not mentioned in the dart docs for RandomAccessFile. Should it be?

A

Anders Holmgren

unread,
Nov 3, 2014, 3:25:59 PM11/3/14
to mi...@dartlang.org
I'm thinking the use of /dev/urandom was likely overkill anyway so created a PR on oauth to just use Random. Is that a fair assessment?

Martin Kustermann

unread,
Nov 5, 2014, 9:54:05 AM11/5/14
to mi...@dartlang.org
Thanks Anders for notifying us about this issue. I don't think this is the expected behaviour. I filed http://dartbug.com/21516 to track this.

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Reply all
Reply to author
Forward
0 new messages