adobe / adobe/aio-cli-plugin-app-dev

dev command should run actions in an isolated process

未关闭
#110 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
JavaScript
星标
2
派生
5
PR 合并指标
30 天内没有已合并 PR

描述

**Describe the bug**
Currently all action code is executed in the same process, which could potentially lead to errors if any action code is modifying process.env it affects the global space.

**To Reproduce**
write 2 actions where 1 is has a sleep function
```
const sleep = async (ms) => new Promise(resolve => setTimeout(resolve, ms))

// main function that will be executed by Adobe I/O Runtime
async function main (params) {

let before = process.env.__OW_ACTIVATION_ID
console.log('before', before)
await sleep(10000)
let after = process.env.__OW_ACTIVATION_ID
console.log('after', after)
return {
statusCode: 200,
body: {
before,
after,
wasCorrupted: (before !== after)
}
}
}

exports.main = main
```

aio app dev and call this action
while it is running, use curl to call the other action

**Expected behavior**
activationId has not changed when sleeper returns
```
time: 10015 ms
{
"before": "d5afdd731a1d2384c55b8bcdb1a453e6",
"after": "d5afdd731a1d2384c55b8bcdb1a453e6",
"wasCorrupted": false
}
```

**Screenshots**
```
time: 10015 ms
{
"before": "d5afdd731a1d2384c55b8bcdb1a453e6",
"after": "f53548458df5870656339859f7af28e6",
"wasCorrupted": true
}
```

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.

贡献指南

打开贡献指南

调研方向

从复现中所示的 `aio app dev` 命令和 action `main` 入口点开始。并发运行两个 action,包括 10 秒的 sleep,并观察 `process.env.__OW_ACTIVATION_ID` 是否在 `before` 和 `after` 之间发生变化。当并发 action 不再影响彼此的 process 环境时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。