Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when running inside Azure App Function: You shall not have another CompilerStack aside me #575

Closed
ihorbond opened this issue Dec 20, 2021 · 4 comments
Labels
bug 🐛 waiting for more input Issues waiting for more input by the reporter

Comments

@ihorbond
Copy link

Hey guys running into an error when running solc-js inside of Azure App Function. Everything compiles and works fine locally but not in the cloud. Tried both node v14 and v16

[
  {
    "component": "general",
    "formattedMessage": "Internal exception in StandardCompiler::compile: /solidity/libsolidity/interface/CompilerStack.cpp(104): Throw in function solidity::frontend::CompilerStack::CompilerStack(ReadCallback::Callback)\nDynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>\nstd::exception::what: You shall not have another CompilerStack aside me.\n[solidity::util::tag_comment*] = You shall not have another CompilerStack aside me.\n",
    "message": "Internal exception in StandardCompiler::compile: /solidity/libsolidity/interface/CompilerStack.cpp(104): Throw in function solidity::frontend::CompilerStack::CompilerStack(ReadCallback::Callback)\nDynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>\nstd::exception::what: You shall not have another CompilerStack aside me.\n[solidity::util::tag_comment*] = You shall not have another CompilerStack aside me.\n",
    "severity": "error",
    "type": "InternalCompilerError"
  }
]
@ihorbond ihorbond changed the title You shall not have another CompilerStack aside me error Azure App Function compiler error Dec 20, 2021
@chriseth
Copy link
Contributor

Can you give more information about how you exactly started the application and what lead to that error?

@ihorbond
Copy link
Author

@chriseth Here is the relevant azure function code

const input = {
        language: 'Solidity',
        sources: {
            [templateName]: {
                content: eval(templateContents)
            }
        },
        settings: {
            outputSelection: { // return everything
                '*': {
                    '*': ['*']
                }
            }
        }
    }

    context.log('about to launch solc compiler')
    
    const output = JSON.parse(
        solc.compile(JSON.stringify(input), { import: findImports })
    );

    if(output.errors) {
        return {
            statusCode: 400,
            body: JSON.stringify(output.errors)
        }
    }

(I know I know eval is bad)
The function itself is triggered by an HTTP POST call to
https://compile-smart-contract.azurewebsites.net/api/compile-smart-contract
with a payload that looks like this

{
  "blockchain": 1,
  "network": "4",
  "hasWhitelist": true,
  "hasDelayedReveal": true,
  "hasOpenSeaRoyalties": true,
  "baseURL": "ipfs://",
  "name": "Bored Apes Yacht Club",
  "symbol": "BAYC",
  "collectionSize": 444,
  "mintPrice": 0.05,
  "maxTokensPerTransaction": 20,
  "whitelistPrice": 0.04,
  "delayedRevealURL": "ipfs://",
  "email": "[email protected]",
  "voucherSigner": "abcdefjhijklmnop"
}

Tried both node v14.14 and v16.4.1

@cameel
Copy link
Member

cameel commented Dec 22, 2021

Does it happen only on Azure or can you also reproduce it locally? I tried it on my machine and I did not get that error but it might just be something in the parts that are not included in your example. E.g. your Solidity source or import callback.

From the info we have so far I can only say that CompilerStack class in the C++ code gets created twice and it's not supposed to so our sanity check fails. Unfortunately it's not enough to tell why this happens.

We'll need a more concrete repro to be able to diagnose this. Could you create a small, self-contained JS snippet that reproduces this? I.e. without any missing parts but for our purposes it's enough to replace them with the simplest equivalent that still makes it crash.

@cameel cameel changed the title Azure App Function compiler error ICE when running inside Azure App Function: You shall not have another CompilerStack aside me Dec 22, 2021
@cameel cameel added this to solc-js Jun 10, 2022
@cameel cameel moved this to Triage in solc-js Jun 10, 2022
@cameel cameel added the waiting for more input Issues waiting for more input by the reporter label Jun 10, 2022
@cameel cameel removed this from solc-js Jun 10, 2022
@cameel
Copy link
Member

cameel commented Jan 24, 2023

Closing as a duplicate of #675. This issue was first but the other one has a repro.

Looks like the problem occurs when an exception interrupts the import callback and you continue to use the compiler after that. This will need a fix in the compiler. For now a crude workaround would probably be to reload the compiler.

@cameel cameel closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 waiting for more input Issues waiting for more input by the reporter
Projects
None yet
Development

No branches or pull requests

3 participants