Events added to in-memory queue are not being raised after ContinueAsNew called. #676
還沒有人認領這個 Issue。
評估
研究方向
先從 issue 中的 orchestrator_function 和 HttpStarter 範例開始,然後透過快速連續傳送兩個請求來重現該行為。追蹤 wait_for_external_event、raise_event 和 continue_as_new 如何處理記憶體中的事件佇列。當第一次請求處理後引發的事件被重新啟動的 orchestrator 接收並處理時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
🐛 Describe the bug
I had the exact same problem as described in the c# library (https://github.com/Azure/azure-functions-durable-extension/issues/676): only the first event is processed when raising event in a quick succession.
🤔 Expected behavior
I was expecting continue_as_new to resume the orchestrator_function and to pick the next event in the queue.
☕ Steps to reproduce
What Durable Functions patterns are you using, if any?
I was testing the singleton orchestrator patterns. Instead of directly invoking the orchestrator, I use raise_event to communicate with the orchestrator. The orchestrator listens to the incoming event with wait_for_external_event and triggers the processing.
Any minimal reproducer we can use?
The orchestrator function
def orchestrator_function(context: df.DurableOrchestrationContext):
logging.warning("orchestrator starts")
result = yield context.wait_for_external_event('wait_for_request')
req = json.loads(result)
yield context.call_activity('Hello1', json.dumps(req))
yield context.call_activity('Hello1', json.dumps(req))
yield context.call_activity('Hello1', json.dumps(req))
logging.warning("orchestrator ends", req)
context.continue_as_new(None)
The Hello1 activity function uses time.sleep(5) to simulate extended processing.
The HttpStarter
async def main(req: func.HttpRequest, starter: str) -> func.HttpResponse:
client = df.DurableOrchestrationClient(starter)
req_body = req.get_json()
function_name = "orchestrator_function"
h = hashlib.sha256()
h.update(str.encode(req_body['endpoint']))
instance_id = h.hexdigest()
existing_instance = await client.get_status(instance_id)
logging.warning(req_body)
logging.warning(f"Start orchestration with ID = '{instance_id}'.")
if existing_instance.runtime_status in [
df.OrchestrationRuntimeStatus.Completed,
df.OrchestrationRuntimeStatus.Failed,
df.OrchestrationRuntimeStatus.Terminated,
None]:
instance_id = await client.start_new(function_name, instance_id, None)
logging.warning(f"Started orchestration with ID = '{instance_id}'.")
await client.raise_event(instance_id, 'wait_for_request', req_body)
return client.create_check_status_response(req, instance_id)
When sending two HTTP requests to the HttpStarter consecutively (not simultaneously but with a bit gap), the orchestrator gets the first message and finishes the processing, but never picks up the second message.
Are you running this locally or on Azure?
I have tested both locally and on Azure. I currently work on a prototype that uses the singleton durable function to control the traffic to endpoints. Some endpoints may allow concurrent traffic and some may not.
⚡If deployed to Azure
We have access to a lot of telemetry that can help with investigations. Please provide as much of the following information as you can to help us investigate!
- Timeframe issue observed: 2021-11-02
- Function App name: tao-func-test1
- Function name(s): adapter_controller (orchestrator), http_trigger (HttpStarter)
- Azure region: US east
- Orchestration instance ID(s): 5e0c90d2d434f24b1ec3df57316653d00de3cc27b2001902cd0983c18e381b78
- Azure storage account name: taofunctest1
If you don't want to share your Function App or storage account name GitHub, please at least share the orchestration instance ID. Otherwise it's extremely difficult to look up information.
- 主要語言
- Python
- 星號
- 157
- 分支
- 71
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Azure/azure-functions-durable-python 的其他 Issue
-
Enhancement fixed-in-v2 P3
難度 2/5 1-3 小時 新手友好度 72/100
Azure/azure-functions-durable-python#617 · 1 則留言 ·
-
bug Debuggability fixed-in-v2 P2
難度 2/5 1-3 小時 新手友好度 72/100
Azure/azure-functions-durable-python#587 · 2 則留言 · 1 個 reaction ·
-
Custom object serialization broken for orchestrator return values可能已有人在做 @andystaples 於 87 天前認領。 未關閉bug fixed-in-v2 P2
難度 2/5 1-3 小時 新手友好度 75/100
Azure/azure-functions-durable-python#568 · 1 則留言 ·
-
bug fixed-in-v2 P3
難度 2/5 1-3 小時 新手友好度 72/100
Azure/azure-functions-durable-python#475 · 1 則留言 ·
-
Enhancement fixed-in-v2 P3
難度 4/5 3-5 天 新手友好度 62/100
Azure/azure-functions-durable-python#618 · 1 則留言 ·
查看 Azure/azure-functions-durable-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
nansencenter/geodataset#39 ·
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
awslabs/visual-asset-management-system#804 ·
維護者通常 1 天內回覆
-
follow-up
難度 2/5 1-3 小時 新手友好度 65/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
link-rot
難度 1/5 1 小時以內 新手友好度 67/100