Skip to content

remove_wasm_modules error: Too many open files #476

Description

@Maatteogekko

Hello, I am running the tool to remove wasm modules on gitlab CI and get the following error.

dart run pdfrx:remove_wasm_modules
Error: FileSystemException: Cannot open file, path = '/myapp/app/pub-cache/hosted/pub.dev/colorize-3.0.0/LICENSE.md' (OS Error: Too many open files, errno = 24)
#0      _checkForErrorResponse (dart:io/common.dart:58:9)
#1      _File.open.<anonymous closure> (dart:io/file_impl.dart:442:7)
<asynchronous suspension>
#2      _File.readAsBytes.<anonymous closure> (dart:io/file_impl.dart:649:24)
<asynchronous suspension>
#3      _File.readAsString (dart:io/file_impl.dart:716:18)
<asynchronous suspension>
#4      Package.fromDirectory (package:dart_pubspec_licenses/src/package.dart:177:21)
<asynchronous suspension>
#5      Package.fromPubspecLockPackageEntry (package:dart_pubspec_licenses/src/package.dart:148:12)
<asynchronous suspension>
#6      Future.wait.<anonymous closure> (dart:async/future.dart:525:21)
<asynchronous suspension>
#7      listDependencies (package:dart_pubspec_licenses/src/license_info_utils.dart:97:26)
<asynchronous suspension>
#8      main (file:///myapp/app/pub-cache/hosted/pub.dev/pdfrx-2.1.14/bin/remove_wasm_modules.dart:31:18)
<asynchronous suspension>

From a quick look at the code it seems like all the license files are being opened in parallel, causing the issue (?).
Can this be optimized? Maybe by introducing some kind of batching or running the scan in series (the tradeoff in speed may be unacceptable though). WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions