Memory leak / persistent high CPU usage when running Phoenix in IIS on Windows

I am trying to prototype a small web application to find out if I can use Phoenix and Elixir to create some intranet web applications for use by my employees in my company. We were a typical Microsoft.NET store forever, but I am interested in playing with some other technologies, with Elixir and Phoenix being two of them.

I have a virtual machine with Windows 10and IIS 8. I installed the HttpPlatformHandler on the virtual machine to run the Phoenix application and pass requests from IIS to it (there is a reason for this, I will take a moment).

When I run my Phoenix application offline in Windows, it works fine. I do not see any problems. When I launch the Phoenix application using HttpPlatformHandlerIIS, I see that the erl.exe process is constantly running and consumes about 35-40% of the processor (I work with 2 cores and 8 GB of RAM on the VM). I also see that memory is constantly growing without stopping. After a couple of minutes, it is pierced with 1 GB and will switch to 2 GB (I observe the memory usage using Process Explorer). There are no downloads or active requests in the Phoenix app. This happens in dev and prod environments.

I want to run Phoenix behind IIS because it is an intranet application and it will work in a Windows domain and most users will be Windows users. I created a plugin that will read the Windows user token from the X-IIS-WindowsAuthTokenHTTP header , which HttpPlatformHandleradds to the requests it sends to the Phoenix process, and I use the NIFS set to call the Windows API to get the Windows SID and domain name \ authenticated user name Authentication to establish a session and authorize the user.

- ? Elixir Phoenix, , , , , Erlang, , , .

, , , Phoenix, mix phoenix.new.

, my web.config Phoenix:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="C:\Projects\neucode\run.bat"
        arguments=""
        stdoutLogEnabled="true"
        forwardWindowsAuthToken="true">
      <environmentVariables>
        <environmentVariable name="MIX_ENV" value="prod"/>
      </environmentVariables>
    </httpPlatform>
  </system.webServer>
</configuration>

run.bat :

mix phoenix.server

, . , , - , , .

.

UPDATE

, Phoenix, IIS, Observer, this gist. , - :

tab

, , , , , :

Port Observer Tab

Trace log for user process and its port

, . - , , , ?

+1
1

. . Elixir/Erlang, Erlang - . , < 10014.664 > "0/1". , 0 == 1 == .

HttpPlatformHandler , Phoenix , . .

, Erlang VM . run.bat script mix phoenix.server, , node, Observer , run.bat script

elixir --name phoenix@127.0.0.1 --cookie PUT_COOKIE_HERE --erl "-noinput" -S mix phoenix.server

-noinput , Erlang . -noinput, , , 0,2% . CPU , Phoenix IIS.

+3

Source: https://habr.com/ru/post/1610449/


All Articles