langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Stop button not working on backend.

Open lucaseduoli opened this issue 1 year ago • 1 comments

Bug Description

The stop button only stops the request on the frontend.

Reproduction

  1. Create a flow
  2. Create a custom component
  3. Add a time.sleep(1000) into the build function of the component
  4. Run the component
  5. Stop the build
  6. Check that the backend is still running the flow, preventing other calls to be made.

Expected behavior

The backend should stop the build so that we can make other calls to the backend.

Who can help?

@italojohnny

Operating System

Macbook M3 Pro

Langflow Version

main

Python Version

3.10

Screenshot

No response

Flow File

No response

lucaseduoli avatar Sep 03 '24 17:09 lucaseduoli

Users should use asyncio.sleep, not time.sleep. There's no way we can avoid blocking the entire application. I'd suggest to mitigate the problem by giving validation error if we detect time.sleep in the component code, suggesting to use await asyncio.sleep(x) instead. The validation is still "overridable" because you could by-pass it in multiple ways (e.g. t = time;t.sleep(1)) but at least will avoid unconscious errors.

nicoloboschi avatar Sep 12 '24 14:09 nicoloboschi

This issue is already resolved!

italojohnny avatar Nov 29 '24 19:11 italojohnny