ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

vm not stopping? #890

Closed pankajsoni19 closed 4 years ago

pankajsoni19 commented 4 years ago

I am using erlang.mk to generate the release. When I issue the command bin/server stop server_app:prep_stop is called and function returns cleanly. however server_app:stop never gets called and the stop command hangs indefinitely. Any idea what would be blocking?

this is the make file.

PROJECT = server
PROJECT_VERSION = $(shell head -n 1 relx.config | awk '{split($$0, a, "\""); print a[2]}')

COMPILE_FIRST = gen_mod

LOCAL_DEPS = inets mnesia os_mon
DEPS = lager p1_utils uuid eredis cowboy erlpool jsx mysql_poolboy erlcloud erlcass edate fcm apns base64url

dep_lager = git https://github.com/erlang-lager/lager 3.8.0
dep_p1_utils = git https://github.com/processone/p1_utils.git 1.0.18
dep_uuid = git https://github.com/okeuday/uuid.git v1.8.0
dep_eredis = git https://github.com/pankajsoni19/eredis.git v1.3.0
dep_cowboy = git https://github.com/ninenines/cowboy.git 2.8.0
dep_erlpool = git https://github.com/pankajsoni19/erlpool.git v1.3
dep_jsx = git https://github.com/talentdeficit/jsx.git v2.10.0
dep_mysql_poolboy = git https://github.com/mysql-otp/mysql-otp-poolboy.git 0.2.0
dep_erlcloud = git https://github.com/erlcloud/erlcloud.git 3.3.1
dep_erlcass = git https://github.com/silviucpp/erlcass v4.0.0
dep_edate = git https://github.com/dweldon/edate.git 640718e
dep_fcm = git https://github.com/pankajsoni19/fcm-erlang.git 1.0.1
dep_apns = git https://github.com/pankajsoni19/apns_erlang.git 2.5.0
dep_base64url = git https://github.com/dvv/base64url.git 1.0.1

include erlang.mk

ERLC_OPTS := $(filter-out -Werror,$(ERLC_OPTS))

ERLC_COMPILE_OPTS= +'{parse_transform, lager_transform}'
ERLC_OPTS += $(ERLC_COMPILE_OPTS)
TEST_ERLC_OPTS += $(ERLC_COMPILE_OPTS)
essen commented 4 years ago

Releases are configured via relx.config and vm.args, do you have anything special in there?

Does it work if you only have the start/stop callbacks and not prep_stop?

Did you try using prep_stop to trace everything the VM is doing after it has been called?

pankajsoni19 commented 4 years ago

yes, I figured it out. Calling any application:fun while in prep_stop blocks it indefinitely. application may be doing a sync_call in module:stop and so essentially this blocks the eventloop indefinitely. I would say this is a bad design or atleast should be documented.