wake icon indicating copy to clipboard operation
wake copied to clipboard

Wake init fails when there are too many files.

Open albertwh1te opened this issue 11 months ago • 1 comments

When I try to init with command:

wake init config

There a the out put :

[17:18:28] Found 258 *.sol files in 2.29 s                                                                                                                                                              init.py:565
           Failed to load previous build artifacts                                                                                                                                                  compiler.py:749


⠴ Compiling 302 files using 104 solc runs...

│   1601 │   │   │   │   pass                                                                      │
│   1602 │   │   │   elif stderr == PIPE:                                                          │
│ ❱ 1603 │   │   │   │   errread, errwrite = os.pipe()                                             │
│   1604 │   │   │   elif stderr == STDOUT:                                                        │
│   1605 │   │   │   │   if c2pwrite != -1:                                                        │
│   1606 │   │   │   │   │   errwrite = c2pwrite                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [Errno 24] Too many open files

How should I solve this?

Here is the full output:

⠸ Compiling 302 files using 104 solc runs...
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/homebrew/Caskroom/miniforge/base/bin/wake:8 in <module>                                     │
│                                                                                                  │
│   5 from wake.cli.__main__ import main                                                           │
│   6 if __name__ == '__main__':                                                                   │
│   7 │   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         │
│ ❱ 8 │   sys.exit(main())                                                                         │
│   9                                                                                              │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/core.py:1128 in __call__ │
│                                                                                                  │
│   1125 │                                                                                         │
│   1126 │   def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:                           │
│   1127 │   │   """Alias for :meth:`main`."""                                                     │
│ ❱ 1128 │   │   return self.main(*args, **kwargs)                                                 │
│   1129                                                                                           │
│   1130                                                                                           │
│   1131 class Command(BaseCommand):                                                               │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/rich_click/rich_command.py:126 │
│ in main                                                                                          │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/core.py:1659 in invoke   │
│                                                                                                  │
│   1656 │   │   │   │   super().invoke(ctx)                                                       │
│   1657 │   │   │   │   sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)                    │
│   1658 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1659 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1660 │   │                                                                                     │
│   1661 │   │   # In chain mode we create the contexts step by step, but after the                │
│   1662 │   │   # base command has been invoked.  Because at that point we do not                 │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/core.py:1659 in invoke   │
│                                                                                                  │
│   1656 │   │   │   │   super().invoke(ctx)                                                       │
│   1657 │   │   │   │   sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)                    │
│   1658 │   │   │   │   with sub_ctx:                                                             │
│ ❱ 1659 │   │   │   │   │   return _process_result(sub_ctx.command.invoke(sub_ctx))               │
│   1660 │   │                                                                                     │
│   1661 │   │   # In chain mode we create the contexts step by step, but after the                │
│   1662 │   │   # base command has been invoked.  Because at that point we do not                 │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/core.py:1395 in invoke   │
│                                                                                                  │
│   1392 │   │   │   echo(style(message, fg="red"), err=True)                                      │
│   1393 │   │                                                                                     │
│   1394 │   │   if self.callback is not None:                                                     │
│ ❱ 1395 │   │   │   return ctx.invoke(self.callback, **ctx.params)                                │
│   1396 │                                                                                         │
│   1397 │   def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]:  │
│   1398 │   │   """Return a list of completions for the incomplete value. Looks                   │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/core.py:754 in invoke    │
│                                                                                                  │
│    751 │   │                                                                                     │
│    752 │   │   with augment_usage_errors(__self):                                                │
│    753 │   │   │   with ctx:                                                                     │
│ ❱  754 │   │   │   │   return __callback(*args, **kwargs)                                        │
│    755 │                                                                                         │
│    756 │   def forward(                                                                          │
│    757 │   │   __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any  # noqa: B902             │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/click/decorators.py:26 in      │
│ new_func                                                                                         │
│                                                                                                  │
│    23 │   """                                                                                    │
│    24 │                                                                                          │
│    25 │   def new_func(*args, **kwargs):  # type: ignore                                         │
│ ❱  26 │   │   return f(get_current_context(), *args, **kwargs)                                   │
│    27 │                                                                                          │
│    28 │   return update_wrapper(t.cast(F, new_func), f)                                          │
│    29                                                                                            │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/wake/cli/init.py:573 in        │
│ run_init_config                                                                                  │
│                                                                                                  │
│   570 │   │   compiler = SolidityCompiler(config)                                                │
│   571 │   │   compiler.load(console=console)                                                     │
│   572 │   │                                                                                      │
│ ❱ 573 │   │   _, errors = asyncio.run(                                                           │
│   574 │   │   │   compiler.compile(                                                              │
│   575 │   │   │   │   sol_files,                                                                 │
│   576 │   │   │   │   [SolcOutputSelectionEnum.ALL],                                             │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/runners.py:44 in run                 │
│                                                                                                  │
│   41 │   │   events.set_event_loop(loop)                                                         │
│   42 │   │   if debug is not None:                                                               │
│   43 │   │   │   loop.set_debug(debug)                                                           │
│ ❱ 44 │   │   return loop.run_until_complete(main)                                                │
│   45 │   finally:                                                                                │
│   46 │   │   try:                                                                                │
│   47 │   │   │   _cancel_all_tasks(loop)                                                         │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/base_events.py:642 in                │
│ run_until_complete                                                                               │
│                                                                                                  │
│    639 │   │   if not future.done():                                                             │
│    640 │   │   │   raise RuntimeError('Event loop stopped before Future completed.')             │
│    641 │   │                                                                                     │
│ ❱  642 │   │   return future.result()                                                            │
│    643 │                                                                                         │
│    644 │   def stop(self):                                                                       │
│    645 │   │   """Stop running the event loop.                                                   │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/wake/compiler/compiler.py:961  │
│ in compile                                                                                       │
│                                                                                                  │
│    958 │   │   with ctx_manager:                                                                 │
│    959 │   │   │   # wait for compilation of all compilation units                               │
│    960 │   │   │   try:                                                                          │
│ ❱  961 │   │   │   │   ret: Tuple[SolcOutput, ...] = await asyncio.gather(*tasks)                │
│    962 │   │   │   except Exception:                                                             │
│    963 │   │   │   │   for task in tasks:                                                        │
│    964 │   │   │   │   │   task.cancel()                                                         │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/wake/compiler/compiler.py:1325 │
│ in compile_unit_raw                                                                              │
│                                                                                                  │
│   1322 │   │   │   │   sources[source_unit_name] = content.decode("utf-8")                       │
│   1323 │   │                                                                                     │
│   1324 │   │   # run the solc executable                                                         │
│ ❱ 1325 │   │   return await self.__solc_frontend.compile(                                        │
│   1326 │   │   │   files, sources, target_version, build_settings                                │
│   1327 │   │   )                                                                                 │
│   1328                                                                                           │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/wake/compiler/solc_frontend/so │
│ lc_runner.py:56 in compile                                                                       │
│                                                                                                  │
│   53 │   │   │   standard_input.sources[unit_name] = SolcInputSource(content=content)            │
│   54 │   │   standard_input.settings = settings                                                  │
│   55 │   │                                                                                       │
│ ❱ 56 │   │   return await self.__run_solc(target_version, standard_input)                        │
│   57 │                                                                                           │
│   58 │   async def __run_solc(                                                                   │
│   59 │   │   self, target_version: SolidityVersion, standard_input: SolcInput                    │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/wake/compiler/solc_frontend/so │
│ lc_runner.py:84 in __run_solc                                                                    │
│                                                                                                  │
│   81 │   │   logger.debug(f"Running solc: {' '.join(args)}")                                     │
│   82 │   │                                                                                       │
│   83 │   │   # the first argument in this call cannot be `Path` because of https://bugs.pytho    │
│ ❱ 84 │   │   proc = await asyncio.create_subprocess_exec(                                        │
│   85 │   │   │   *args,                                                                          │
│   86 │   │   │   cwd=self.__config.project_root_path,                                            │
│   87 │   │   │   stdin=subprocess.PIPE,                                                          │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/subprocess.py:236 in                 │
│ create_subprocess_exec                                                                           │
│                                                                                                  │
│   233 │   │   )                                                                                  │
│   234 │   protocol_factory = lambda: SubprocessStreamProtocol(limit=limit,                       │
│   235 │   │   │   │   │   │   │   │   │   │   │   │   │   │   loop=loop)                         │
│ ❱ 236 │   transport, protocol = await loop.subprocess_exec(                                      │
│   237 │   │   protocol_factory,                                                                  │
│   238 │   │   program, *args,                                                                    │
│   239 │   │   stdin=stdin, stdout=stdout,                                                        │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/base_events.py:1661 in               │
│ subprocess_exec                                                                                  │
│                                                                                                  │
│   1658 │   │   │   # (password) and may be too long                                              │
│   1659 │   │   │   debug_log = f'execute program {program!r}'                                    │
│   1660 │   │   │   self._log_subprocess(debug_log, stdin, stdout, stderr)                        │
│ ❱ 1661 │   │   transport = await self._make_subprocess_transport(                                │
│   1662 │   │   │   protocol, popen_args, False, stdin, stdout, stderr,                           │
│   1663 │   │   │   bufsize, **kwargs)                                                            │
│   1664 │   │   if self._debug and debug_log is not None:                                         │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/unix_events.py:197 in                │
│ _make_subprocess_transport                                                                       │
│                                                                                                  │
│    194 │   │   │   │   raise RuntimeError("asyncio.get_child_watcher() is not activated, "       │
│    195 │   │   │   │   │   │   │   │      "subprocess support is not installed.")                │
│    196 │   │   │   waiter = self.create_future()                                                 │
│ ❱  197 │   │   │   transp = _UnixSubprocessTransport(self, protocol, args, shell,                │
│    198 │   │   │   │   │   │   │   │   │   │   │     stdin, stdout, stderr, bufsize,             │
│    199 │   │   │   │   │   │   │   │   │   │   │     waiter=waiter, extra=extra,                 │
│    200 │   │   │   │   │   │   │   │   │   │   │     **kwargs)                                   │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/base_subprocess.py:36 in __init__    │
│                                                                                                  │
│    33 │   │                                                                                      │
│    34 │   │   # Create the child process: set the _proc attribute                                │
│    35 │   │   try:                                                                               │
│ ❱  36 │   │   │   self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,                │
│    37 │   │   │   │   │   │   stderr=stderr, bufsize=bufsize, **kwargs)                          │
│    38 │   │   except:                                                                            │
│    39 │   │   │   self.close()                                                                   │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/asyncio/unix_events.py:789 in _start         │
│                                                                                                  │
│    786 │   │   │   # just fine on other platforms.                                               │
│    787 │   │   │   stdin, stdin_w = socket.socketpair()                                          │
│    788 │   │   try:                                                                              │
│ ❱  789 │   │   │   self._proc = subprocess.Popen(                                                │
│    790 │   │   │   │   args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr,             │
│    791 │   │   │   │   universal_newlines=False, bufsize=bufsize, **kwargs)                      │
│    792 │   │   │   if stdin_w is not None:                                                       │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/subprocess.py:829 in __init__                │
│                                                                                                  │
│    826 │   │                                                                                     │
│    827 │   │   (p2cread, p2cwrite,                                                               │
│    828 │   │    c2pread, c2pwrite,                                                               │
│ ❱  829 │   │    errread, errwrite) = self._get_handles(stdin, stdout, stderr)                    │
│    830 │   │                                                                                     │
│    831 │   │   # We wrap OS handles *before* launching the child, otherwise a                    │
│    832 │   │   # quickly terminating child could make our fds unwrappable                        │
│                                                                                                  │
│ /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/subprocess.py:1603 in _get_handles           │
│                                                                                                  │
│   1600 │   │   │   if stderr is None:                                                            │
│   1601 │   │   │   │   pass                                                                      │
│   1602 │   │   │   elif stderr == PIPE:                                                          │
│ ❱ 1603 │   │   │   │   errread, errwrite = os.pipe()                                             │
│   1604 │   │   │   elif stderr == STDOUT:                                                        │
│   1605 │   │   │   │   if c2pwrite != -1:                                                        │
│   1606 │   │   │   │   │   errwrite = c2pwrite                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [Errno 24] Too many open files

albertwh1te avatar Feb 28 '24 09:02 albertwh1te