Skip to content

Azure Functions local process not killed properly on Mac/IntelliJ #6374

@justinyoo

Description

@justinyoo

Hi, Team.

I'm not sure this is the issue from this plugin or IntelliJ itself, but I'd like to create an issue here. Here's my dev environment:

  • Mac OS (Monterey; 12.2)
  • IntelliJ CE (2021.3.2)
  • Azure Tools for IntelliJ 3.61.1 - 2021.3
  • Azure Functions Core Tools v4 4.0.3971

Here's how to reproduce the error:

  1. Run an Azure Functions app from IntelliJ.
  2. Confirm that it takes the port of 7071.
  3. Stop the app.
  4. Re-run the Azure Functions app from IntelliJ.
  5. Confirm that the port 7071 is still occupied by another process.

image

Therefore, in order to re-run the Function app, I have to manually find and kill the process every time. Here's what I use to kill the process:

https://gist.github.com/justinyoo/045201b2c4280c818ca872af6284c720

I google'd whether it's the issue of IntelliJ itself or this plugin, and found these threads:

Although they're a bit old conversations, apparently other devs are experiencing similar issues. So, I checked the code how it's handled and found it:

private static void stopProcessIfAlive(final Process proc) {
if (proc != null && proc.isAlive()) {
proc.destroy();
}
}

As I'm not a Java dev, I don't know what the code exactly means. But, I suspect that the code doesn't kill all the child processes. Because Azure Functions runtime takes at least two processes - main for the runtime itself and one sub process for the language worker, when the tool stops the process it should stop all the processes including main and its sub.

it would be great if you can take a look.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions