ityonemo

ityonemo

Getting zombies with erlexec

Hi! I’m still getting zombie processes with erlexec and nothing that I do seems to be able to resolve this. Firstly, i’m on linux. Secondly, i can’t use muontrap, since I need to stream input and output into the other process.

Here’s the code:

  #... Genserver Headers
  def init(_) do
    :erlexec.run_link("priv/forever.sh", [:stderr, :stdout, :kill_group])
    #...

forever.sh

#!/bin/bash

while true; do
  sleep 1
end

Control-c/a definitely creates a zombie (I think the GenServer doesn’t even get the stop message), and even System.stop(0) creates a zombie.

I’m free to put anything in the top of the forever script, so if I can use that to, maybe set the process group or a job, I can definitely do that, but I’m not familiar enough with linux to know if that makes sense. thanks

Thanks in advance.

Most Liked

akash-akya

akash-akya

There is no clean way to do it without using middleware if you are consuming stdin. You need another OS process which act like monitor and do the cleanup. mountrap & ExCmd are such middlewere, but mountrap does not support communicating with the external process and ex_cmd does.

Also If you are streaming a lot of data in/out of beam then it can lead to memory issue. ex_cmd also solves that. See memory issue mentioned here

lud

lud

Not sure if rambo could help there as I think it does the same thing as muontrap, but maybe worth checking.

LostKobrakai

LostKobrakai

You can also take look at ex_cmd.

Last Post!

ityonemo

ityonemo

sadly none of the above solutions worked. I was able to get a solution I was okay with:

  1. use :os.getpid() to get the os pid of the erlang process.
  2. in the shell script, patrol to see if erlang process is still alive
  3. if it’s not, tear down the script and all its children.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49084 226
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement