foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.12k stars 1.68k forks source link

SIGKILL on `forge build` when compiling many contracts on low memory system (8GB) #8525

Closed pegahcarter closed 1 month ago

pegahcarter commented 1 month ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.2.0 (fe2acca 2024-07-22T00:20:15.468269927Z)

What command(s) is the bug in?

forge build

Operating System

Linux

Describe the bug

https://github.com/ethereum-optimism/optimism/issues/8646#issuecomment-2251203301

When trying to build the contracts locally (8GB ram):

carter@laptop:~/optimism/packages/contracts-bedrock$ forge build
Missing dependencies found. Installing now...

...

[⠆] Compiling...
[⠰] Compiling 16 files with Solc 0.8.19
[⠔] Compiling 394 files with Solc 0.8.15
[⠰] Compiling 138 files with Solc 0.8.25
[⠢] Solc 0.8.19 finished in 2.79s
[⠊] Solc 0.8.25 finished in 35.60s
Error: 
solc exited with signal: 9 (SIGKILL)
zerosnacks commented 1 month ago

As reported here: https://github.com/ethereum-optimism/optimism/issues/8646#issuecomment-1863282669 this is a known issue of the Solidity compiler.

I think the most related feature request is this: https://github.com/foundry-rs/foundry/issues/166 where a dependency graph for multithreaded compilation could also be used to throttle. I think it makes most sense to pursue this in the Solidity compiler, for context see: https://github.com/foundry-rs/foundry/issues/166#issuecomment-2133290512

DaniPopes commented 1 month ago

Duplicate + non-actionable