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

panicked at already borrowed: BorrowMutError #7

Closed
clangenb opened this issue Aug 16, 2022 · 2 comments
Closed

panicked at already borrowed: BorrowMutError #7

clangenb opened this issue Aug 16, 2022 · 2 comments

Comments

@clangenb
Copy link

When running benchmarks, we are getting the following error, and we have problems finding the issue, we never had any problems under normal load. The potential causes coming to my mind is a potentially deep nesting of with calls due to access from different threads. This is how we use it: https://github.com/integritee-network/sgx-runtime/blob/7249cad5f43f73f2fc8f676a6a2435f057962b73/substrate-sgx/sp-io/src/lib.rs#L109

thread '' panicked at 'already borrowed: BorrowMutError', /home/sproll/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.3/src/lib.rs:142:41
note: Call backtrace::enable_backtrace with 'PrintFormat::Short/Full' for a backtrace.
fatal runtime error: failed to initiate panic, error 5

Do you have any idea, what it could be?

@haerdib
Copy link

haerdib commented Aug 24, 2022

In case someone else runs into this: The root problem was that we've run the library inside a no_std environment (intel sgx enclave to be precise), but in a multithreaded one. The local_key implementation of https://github.com/paritytech/environmental/blob/master/src/local_key.rs#L26 does not seem to be able to handle that.

In our case, the solution was to use the sgx provided local_key implementation instead.

@clangenb
Copy link
Author

clangenb commented Aug 24, 2022

I guess I will close this issue, as this is the expected behaviour. Thanks for investigating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants