windmill-labs / windmill

Open-source developer platform to turn scripts into workflows and UIs. Fastest workflow engine (5x vs Airflow). Open-source alternative to Airplane and Retool.
https://windmill.dev
Other
9.6k stars 439 forks source link

bug: circular imports cause an infinite loop #4284

Closed invakid404 closed 1 week ago

invakid404 commented 3 weeks ago

Describe the bug

If you have scripts that import each other forming a circular import, trying to deploy them causes Windmill to enter an infinite loop, filling the job queue with dependency tasks.

I tested this specifically with Bun scripts, but I'd imagine this could be true for other languages as well.

To reproduce

  1. Create two scripts that import each other (I personally did this all at once with the Windmill CLI). For example:
// u/windmill/a.ts
import { world } from "./b.ts";

export const hello = () => {
  return world();
};

export async function main() {
  return hello();
}

// u/windmill/b.ts
import { hello } from "./a.ts";

export const world = () => {
  return "Hello, world!";
};

export async function main() {
  return hello();
}
  1. Try clicking "Deploy" on either of them
  2. Observe the job queue getting filled with dependency runs

Expected behavior

Windmill should detect and report circular import errors like these and fail.

Screenshots

No response

Browser information

No response

Application version

EE v1.383.1

Additional Context

No response

rubenfiszel commented 3 weeks ago

Thanks, we will take a look

rubenfiszel commented 1 week ago

Fixed in https://github.com/windmill-labs/windmill/commit/cdd7349f6769a0195f367a1ac27f802287a1f900