Closed lukaleli closed 6 years ago
As far as I remember the only state GenServer keeps in this case is a pair of keys. Did you try stop gen_server:stop
the instance?
Yes, I've actually tried stop/2
right after writing that question and stopping GenServer that way cleans up the process. But there's another problem. When GenServer times out there are created additional 2 processes. So when GenServer times out I am left with 3 processes not cleaned up. And I don't know why.
Sorry for the late answer.
Well, the erlazure gen server itself doesn't start any additional processes, I guess you need to link the process that starts erlazure and erlazure process itself. So if upload fails then caller process will also crash so you can handle crashes at other level.
erlazure is just a gen server with account keys as state:
init({Account, Key}) ->
{ok, #state { account = Account,
key = Key,
param_specs = get_req_param_specs() }}.
You can also specify timeout on operations, if that helps.
From what I understood from the source code erlazure is a genserver using synchronous server calls. Calling new
put_block_blob
functions on a single process will just queue up my requests and will take them one after another from the process mailbox. Also erlazure server process created with astart
method never exits (or is clean up). What I'm trying to achieve are concurrent uploads to the Blob Storage, but starting new erlazure process in every upload process seems like an overkill, because started processes are never cleaned up and this can easily lead to system blowing up. Am I right with my assumptions? What are the best ways to clean up erlazure process after every upload gracefully?Thanks!