You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by xuguoliang <no...@github.com.INVALID> on 2021/07/30 07:11:18 UTC

[apache/incubator-teaclave] The payload is too large, how to fix? (#533)

I use a  wasm Excutor, the wasm file is 1.2M. I register the wasm function to the teaclave. Some error have occured:

**_{'result': 'err', 'request_error': 'storage error'}

   function_id = client.register_function(
  File "/root/incubator-teaclave/sdk/python/teaclave.py", line 375, in register_function
    return response["content"]["function_id"]_**

How to fix this problem? Or what the max size of payload file?  Or how to increase the size of wasm that the enclave can accept?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by Hongbo <no...@github.com.INVALID>.
Solved.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#issuecomment-907463465

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by Hongbo <no...@github.com.INVALID>.
Closed #533.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#event-5220578214

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by Hongbo <no...@github.com.INVALID>.
Hi @xglreal this problem really exists and we're actively working on a fix.

> How to fix this problem?

Unfortunately, there is no sysctematical fix to this problem. We'll explore if there is a hot/quick fix to just enlarge the memory space so it can hold larger function input.

> Or what the max size of payload file?

Around 700KB.

> Or how to increase the size of wasm that the enclave can accept?

The problem originates in Teaclave's design. In current design, payloads are transmitted in *string*, which is bad for performance. We need to modify the APIs of Teaclave and it's internal protocol to support large function payload.

If you want to try to reduce the size of wasm file, you may try [wasm-gc](https://crates.io/crates/wasm-gc/0.1.6) and add this snippet in `Cargo.toml`:

```
[profile.release]
lto = true
opt-level = "s"
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#issuecomment-889945307

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by Hongbo <no...@github.com.INVALID>.
This error is basicly saying that your WASM binary may contain a function call which can not be handled in the WASM runtime (sandbox). Please make sure your code doesn't contain any syscalls and functions defined outside, except the Teaclave context file interfaces. You may refer to [this document](https://teaclave.apache.org/docs/executing-wasm/) for the restrictions:

> 1. Be self-contained: not depending on libraries which are not provided by Teaclave, including standard libraries.
> 2. Contains no syscall: no system call-related code.
> 3. Implement required interface: exporting an int entrypoint(int argc, char* argv[]) function which is compatible with Teaclave WAMR calling convention (see examples for more details).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#issuecomment-891056003

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by Hongbo <no...@github.com.INVALID>.
Hi @xglreal if you want a hot fix, please enlarge the the enclave's heap size. 

I've tested it's effectiveness, but I'm not sure how much you need to run your code. You need update the heap size in the enclave's configuration file, [e.g.](https://github.com/apache/incubator-teaclave/blob/master/services/execution/enclave/Enclave.config.xml#L6). Please change the storage, management, scheduler, and execution service enclaves.

Besides, if your WASM app needs more memory, please remember to adjust the heap/stack size of WAMR [here](https://github.com/apache/incubator-teaclave/blob/master/executor/src/wamr.rs#L32).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#issuecomment-890119858

Re: [apache/incubator-teaclave] The payload is too large, how to fix? (#533)

Posted by xuguoliang <no...@github.com.INVALID>.
> Hi @xglreal if you want a hot fix, please enlarge the the enclave's heap size.
> 
> I've tested it's effectiveness, but I'm not sure how much you need to run your code. You need update the heap size in the enclave's configuration file, [e.g.](https://github.com/apache/incubator-teaclave/blob/master/services/execution/enclave/Enclave.config.xml#L6). Please change the storage, management, scheduler, and execution service enclaves.
> 
> Besides, if your WASM app needs more memory, please remember to adjust the heap/stack size of WAMR [here](https://github.com/apache/incubator-teaclave/blob/master/executor/src/wamr.rs#L32).

Thanks,the file can be uploaded to the enclave. But there has another question that how to debug the wasm when run in the enclave. The wasm rust can run correct in my computer local. But builded wasm had occured errors that didn't have detail message.

Here is the error:
Exception: unreachable


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave/issues/533#issuecomment-890962978