# Get rid of "Potential deadlock detected" message while waiting for a signal

**URL:** https://community.temporal.io/t/get-rid-of-potential-deadlock-detected-message-while-waiting-for-a-signal/7387
**Category:** Community Support
**Tags:** python-sdk
**Created:** [February 24, 2023, 5:39pm UTC](https://community.temporal.io/t/get-rid-of-potential-deadlock-detected-message-while-waiting-for-a-signal/7387 "2023-02-24T17:39:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Isptn](https://avatars.discourse-cdn.com/v4/letter/i/e36b37/32.png) [@Isptn](https://community.temporal.io/u/Isptn)
#### Post date: [February 24, 2023, 5:39pm UTC](https://community.temporal.io/t/get-rid-of-potential-deadlock-detected-message-while-waiting-for-a-signal/7387/1 "2023-02-24T17:39:25Z")

</div>

I am waiting for a signal but getting “Potential deadlock detected” error. Workflow is still running so I assume maybe something is not configured correctly.

```auto

@workflow.defn
class RequestDataWorkflow:
    def __init__ (self) -> None:
        self._result = None

    @workflow.run
    async def run(self, params: RequestDataParams) -> RequestDataResult:
        activity_params = Params(
            to_email=params.email,
            first_name=params.first_name,
            last_name=params.tlast_name,
            sender_first_name=params.user_first_name,
            sender_last_name=params.user_last_name
        )

        activity_results = await workflow.execute_activity(
            send_email,
            activity_params,
            schedule_to_close_timeout=timedelta(seconds=5)
        )

        while True:
            if not (self._result is None):
                return RequestDataResult(
                    conversation_id=activity_results.conversation_id,
                    number=self._request_sin_workflow_result.number,
                    first_name=self._request_sin_workflow_result.first_name,
                    ast_name=self._request_sin_workflow_result.last_name,
                    middle_name=self._request_sin_workflow_result.middle_name
                )

    @workflow.signal(name="FORM_SUBMITTED")
    async def submit_greeting(self, res: RequestDataResult) -> None:
        self._result = res

```

---

<div class="post-metadata">

### Author: ![Chad\_Retz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chad_retz/32/1396_2.png) [@Chad\_Retz](https://community.temporal.io/u/Chad_Retz)
#### Post date: [February 24, 2023, 5:41pm UTC](https://community.temporal.io/t/get-rid-of-potential-deadlock-detected-message-while-waiting-for-a-signal/7387/2 "2023-02-24T17:41:38Z")

</div>

That `while` loop is a busy loop that will block the event loop and block workflow progress. Consider changing to:

```python
await workflow.wait_condition(lambda: self._result is not None)

```

Alternatively you can use `asyncio.Queue` like [this example](https://github.com/temporalio/samples-python/blob/main/hello/hello_signal.py) does to have the workflow function wait on a signal to set data
