Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Events added to in-memory queue are not being raised after ContinueAsNew called. #676

未關閉
#331 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
azure, python
領域
backend, cloud

研究方向

先從 issue 中的 orchestrator_function 和 HttpStarter 範例開始,然後透過快速連續傳送兩個請求來重現該行為。追蹤 wait_for_external_event、raise_event 和 continue_as_new 如何處理記憶體中的事件佇列。當第一次請求處理後引發的事件被重新啟動的 orchestrator 接收並處理時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

bug Enhancement fixed-in-v2 P2

🐛 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

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Azure/azure-functions-durable-python 的其他 Issue

查看 Azure/azure-functions-durable-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。