ahmetb / runsd

Drop-in Service Discovery capabilities for Google Cloud Run.

Home Page:https://ahmet.im/blog/cloud-run-service-discovery/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subprocess exits

eturan opened this issue · comments

Hi,

I try to run Kong Gateway (https://hub.docker.com/layers/kong/library/kong/2.1.2/images/sha256-4b32def28f08747719387529dc59a880c8fd09adf35ac368444ce79263903620?context=explore) in runsd.

The container works if we don't start it without runsd. If we use runsd, we get the following error;

I0430 10:21:39.543587       1 main.go:81] starting runsd version=0.0.0-rc.12 commit=2b7437bb12f6f0e15495062d189bfd06fb80091d pid=1
I0430 10:21:39.543964       1 main.go:115] on cloudrun: false
I0430 10:21:39.543978       1 main.go:144] skipping dns servers initialization
I0430 10:21:39.543987       1 main.go:200] skipping http proxy server initialization
I0430 10:21:39.543995       1 main.go:229] starting subprocess. cmd="./cloudrun.sh" argv=[]string(nil)
2021/04/30 10:21:39 [verbose] Kong: 2.4.0
2021/04/30 10:21:39 [debug] ngx_lua: 10019
2021/04/30 10:21:39 [debug] nginx: 1019003
2021/04/30 10:21:39 [debug] Lua: LuaJIT 2.1.0-beta3
2021/04/30 10:21:39 [verbose] no config file found at /etc/kong/kong.conf
2021/04/30 10:21:39 [verbose] no config file found at /etc/kong.conf
2021/04/30 10:21:39 [verbose] no config file, skip loading
2021/04/30 10:21:39 [debug] reading environment variables
2021/04/30 10:21:39 [debug] KONG_PLUGINS ENV found with "bundled"
2021/04/30 10:21:39 [debug] KONG_DECLARATIVE_CONFIG ENV found with "/data/main/kong.yaml"
2021/04/30 10:21:39 [debug] KONG_DATABASE ENV found with "off"
2021/04/30 10:21:39 [debug] admin_access_log = "logs/admin_access.log"
2021/04/30 10:21:39 [debug] admin_error_log = "logs/error.log"
2021/04/30 10:21:39 [debug] admin_listen = {"127.0.0.1:8001 reuseport backlog=16384","127.0.0.1:8444 http2 ssl reuseport backlog=16384"}
2021/04/30 10:21:39 [debug] admin_ssl_cert = {}
2021/04/30 10:21:39 [debug] admin_ssl_cert_key = {}
2021/04/30 10:21:39 [debug] anonymous_reports = true
2021/04/30 10:21:39 [debug] cassandra_contact_points = {"127.0.0.1"}
2021/04/30 10:21:39 [debug] cassandra_data_centers = {"dc1:2","dc2:3"}
2021/04/30 10:21:39 [debug] cassandra_keyspace = "kong"
2021/04/30 10:21:39 [debug] cassandra_lb_policy = "RequestRoundRobin"
2021/04/30 10:21:39 [debug] cassandra_port = 9042
2021/04/30 10:21:39 [debug] cassandra_read_consistency = "ONE"
2021/04/30 10:21:39 [debug] cassandra_refresh_frequency = 60
2021/04/30 10:21:39 [debug] cassandra_repl_factor = 1
2021/04/30 10:21:39 [debug] cassandra_repl_strategy = "SimpleStrategy"
2021/04/30 10:21:39 [debug] cassandra_schema_consensus_timeout = 10000
2021/04/30 10:21:39 [debug] cassandra_ssl = false
2021/04/30 10:21:39 [debug] cassandra_ssl_verify = false
2021/04/30 10:21:39 [debug] cassandra_timeout = 5000
2021/04/30 10:21:39 [debug] cassandra_username = "kong"
2021/04/30 10:21:39 [debug] cassandra_write_consistency = "ONE"
2021/04/30 10:21:39 [debug] client_body_buffer_size = "8k"
2021/04/30 10:21:39 [debug] client_max_body_size = "0"
2021/04/30 10:21:39 [debug] client_ssl = false
2021/04/30 10:21:39 [debug] cluster_control_plane = "127.0.0.1:8005"
2021/04/30 10:21:39 [debug] cluster_data_plane_purge_delay = 1209600
2021/04/30 10:21:39 [debug] cluster_listen = {"0.0.0.0:8005"}
2021/04/30 10:21:39 [debug] cluster_mtls = "shared"
2021/04/30 10:21:39 [debug] cluster_ocsp = "off"
2021/04/30 10:21:39 [debug] database = "off"
2021/04/30 10:21:39 [debug] db_cache_ttl = 0
2021/04/30 10:21:39 [debug] db_cache_warmup_entities = {"services"}
2021/04/30 10:21:39 [debug] db_resurrect_ttl = 30
2021/04/30 10:21:39 [debug] db_update_frequency = 5
2021/04/30 10:21:39 [debug] db_update_propagation = 0
2021/04/30 10:21:39 [debug] declarative_config = "/data/main/kong.yaml"
2021/04/30 10:21:39 [debug] dns_error_ttl = 1
2021/04/30 10:21:39 [debug] dns_hostsfile = "/etc/hosts"
2021/04/30 10:21:39 [debug] dns_no_sync = false
2021/04/30 10:21:39 [debug] dns_not_found_ttl = 30
2021/04/30 10:21:39 [debug] dns_order = {"LAST","SRV","A","CNAME"}
2021/04/30 10:21:39 [debug] dns_resolver = {}
2021/04/30 10:21:39 [debug] dns_stale_ttl = 4
2021/04/30 10:21:39 [debug] error_default_type = "text/plain"
2021/04/30 10:21:39 [debug] go_plugins_dir = "off"
2021/04/30 10:21:39 [debug] go_pluginserver_exe = "/usr/local/bin/go-pluginserver"
2021/04/30 10:21:39 [debug] headers = {"server_tokens","latency_tokens"}
2021/04/30 10:21:39 [debug] host_ports = {}
2021/04/30 10:21:39 [debug] kic = false
2021/04/30 10:21:39 [debug] log_level = "notice"
2021/04/30 10:21:39 [debug] lua_package_cpath = ""
2021/04/30 10:21:39 [debug] lua_package_path = "./?.lua;./?/init.lua;"
2021/04/30 10:21:39 [debug] lua_socket_pool_size = 30
2021/04/30 10:21:39 [debug] lua_ssl_protocols = "TLSv1.1 TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] lua_ssl_trusted_certificate = {}
2021/04/30 10:21:39 [debug] lua_ssl_verify_depth = 1
2021/04/30 10:21:39 [debug] mem_cache_size = "128m"
2021/04/30 10:21:39 [debug] nginx_admin_client_body_buffer_size = "10m"
2021/04/30 10:21:39 [debug] nginx_admin_client_max_body_size = "10m"
2021/04/30 10:21:39 [debug] nginx_admin_directives = {{name="client_max_body_size",value="10m"},{name="client_body_buffer_size",value="10m"}}
2021/04/30 10:21:39 [debug] nginx_daemon = "on"
2021/04/30 10:21:39 [debug] nginx_events_directives = {{name="worker_connections",value="auto"},{name="multi_accept",value="on"}}
2021/04/30 10:21:39 [debug] nginx_events_multi_accept = "on"
2021/04/30 10:21:39 [debug] nginx_events_worker_connections = "auto"
2021/04/30 10:21:39 [debug] nginx_http_client_body_buffer_size = "8k"
2021/04/30 10:21:39 [debug] nginx_http_client_max_body_size = "0"
2021/04/30 10:21:39 [debug] nginx_http_directives = {{name="ssl_session_tickets",value="on"},{name="ssl_session_timeout",value="1d"},{name="lua_ssl_protocols",value="TLSv1.1 TLSv1.2 TLSv1.3"},{name="client_max_body_size",value="0"},{name="client_body_buffer_size",value="8k"},{name="ssl_dhparam",value="ffdhe2048"},{name="ssl_protocols",value="TLSv1.2 TLSv1.3"},{name="ssl_prefer_server_ciphers",value="off"}}
2021/04/30 10:21:39 [debug] nginx_http_lua_ssl_protocols = "TLSv1.1 TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] nginx_http_ssl_dhparam = "ffdhe2048"
2021/04/30 10:21:39 [debug] nginx_http_ssl_prefer_server_ciphers = "off"
2021/04/30 10:21:39 [debug] nginx_http_ssl_protocols = "TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] nginx_http_ssl_session_tickets = "on"
2021/04/30 10:21:39 [debug] nginx_http_ssl_session_timeout = "1d"
2021/04/30 10:21:39 [debug] nginx_http_status_directives = {}
2021/04/30 10:21:39 [debug] nginx_http_upstream_directives = {}
2021/04/30 10:21:39 [debug] nginx_main_daemon = "on"
2021/04/30 10:21:39 [debug] nginx_main_directives = {{name="worker_processes",value="auto"},{name="daemon",value="on"},{name="worker_rlimit_nofile",value="auto"}}
2021/04/30 10:21:39 [debug] nginx_main_worker_processes = "auto"
2021/04/30 10:21:39 [debug] nginx_main_worker_rlimit_nofile = "auto"
2021/04/30 10:21:39 [debug] nginx_optimizations = true
2021/04/30 10:21:39 [debug] nginx_proxy_directives = {{name="real_ip_header",value="X-Real-IP"},{name="real_ip_recursive",value="off"}}
2021/04/30 10:21:39 [debug] nginx_proxy_real_ip_header = "X-Real-IP"
2021/04/30 10:21:39 [debug] nginx_proxy_real_ip_recursive = "off"
2021/04/30 10:21:39 [debug] nginx_sproxy_directives = {}
2021/04/30 10:21:39 [debug] nginx_status_directives = {}
2021/04/30 10:21:39 [debug] nginx_stream_directives = {{name="ssl_session_tickets",value="on"},{name="ssl_session_timeout",value="1d"},{name="ssl_dhparam",value="ffdhe2048"},{name="lua_ssl_protocols",value="TLSv1.1 TLSv1.2 TLSv1.3"},{name="ssl_protocols",value="TLSv1.2 TLSv1.3"},{name="ssl_prefer_server_ciphers",value="off"}}
2021/04/30 10:21:39 [debug] nginx_stream_lua_ssl_protocols = "TLSv1.1 TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] nginx_stream_ssl_dhparam = "ffdhe2048"
2021/04/30 10:21:39 [debug] nginx_stream_ssl_prefer_server_ciphers = "off"
2021/04/30 10:21:39 [debug] nginx_stream_ssl_protocols = "TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] nginx_stream_ssl_session_tickets = "on"
2021/04/30 10:21:39 [debug] nginx_stream_ssl_session_timeout = "1d"
2021/04/30 10:21:39 [debug] nginx_supstream_directives = {}
2021/04/30 10:21:39 [debug] nginx_upstream_directives = {}
2021/04/30 10:21:39 [debug] nginx_worker_processes = "auto"
2021/04/30 10:21:39 [debug] pg_database = "kong"
2021/04/30 10:21:39 [debug] pg_host = "127.0.0.1"
2021/04/30 10:21:39 [debug] pg_max_concurrent_queries = 0
2021/04/30 10:21:39 [debug] pg_port = 5432
2021/04/30 10:21:39 [debug] pg_ro_ssl = false
2021/04/30 10:21:39 [debug] pg_ro_ssl_verify = false
2021/04/30 10:21:39 [debug] pg_semaphore_timeout = 60000
2021/04/30 10:21:39 [debug] pg_ssl = false
2021/04/30 10:21:39 [debug] pg_ssl_verify = false
2021/04/30 10:21:39 [debug] pg_timeout = 5000
2021/04/30 10:21:39 [debug] pg_user = "kong"
2021/04/30 10:21:39 [debug] plugins = {"bundled","unl-authenticator"}
2021/04/30 10:21:39 [debug] pluginserver_names = {}
2021/04/30 10:21:39 [debug] port_maps = {}
2021/04/30 10:21:39 [debug] prefix = "/usr/local/kong/"
2021/04/30 10:21:39 [debug] proxy_access_log = "logs/access.log"
2021/04/30 10:21:39 [debug] proxy_error_log = "logs/error.log"
2021/04/30 10:21:39 [debug] proxy_listen = {"0.0.0.0:8000 reuseport backlog=16384","0.0.0.0:8443 http2 ssl reuseport backlog=16384"}
2021/04/30 10:21:39 [debug] real_ip_header = "X-Real-IP"
2021/04/30 10:21:39 [debug] real_ip_recursive = "off"
2021/04/30 10:21:39 [debug] role = "traditional"
2021/04/30 10:21:39 [debug] ssl_cert = {}
2021/04/30 10:21:39 [debug] ssl_cert_key = {}
2021/04/30 10:21:39 [debug] ssl_cipher_suite = "intermediate"
2021/04/30 10:21:39 [debug] ssl_ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384"
2021/04/30 10:21:39 [debug] ssl_dhparam = "ffdhe2048"
2021/04/30 10:21:39 [debug] ssl_prefer_server_ciphers = "on"
2021/04/30 10:21:39 [debug] ssl_protocols = "TLSv1.1 TLSv1.2 TLSv1.3"
2021/04/30 10:21:39 [debug] ssl_session_tickets = "on"
2021/04/30 10:21:39 [debug] ssl_session_timeout = "1d"
2021/04/30 10:21:39 [debug] status_access_log = "off"
2021/04/30 10:21:39 [debug] status_error_log = "logs/status_error.log"
2021/04/30 10:21:39 [debug] status_listen = {"off"}
2021/04/30 10:21:39 [debug] status_ssl_cert = {}
2021/04/30 10:21:39 [debug] status_ssl_cert_key = {}
2021/04/30 10:21:39 [debug] stream_listen = {"off"}
2021/04/30 10:21:39 [debug] trusted_ips = {}
2021/04/30 10:21:39 [debug] untrusted_lua = "sandbox"
2021/04/30 10:21:39 [debug] untrusted_lua_sandbox_environment = {}
2021/04/30 10:21:39 [debug] untrusted_lua_sandbox_requires = {}
2021/04/30 10:21:39 [debug] upstream_keepalive_idle_timeout = 60
2021/04/30 10:21:39 [debug] upstream_keepalive_max_requests = 100
2021/04/30 10:21:39 [debug] upstream_keepalive_pool_size = 60
2021/04/30 10:21:39 [debug] worker_consistency = "strict"
2021/04/30 10:21:39 [debug] worker_state_update_frequency = 5
2021/04/30 10:21:39 [verbose] prefix in use: /usr/local/kong
2021/04/30 10:21:39 [verbose] preparing nginx prefix directory at /usr/local/kong
2021/04/30 10:21:39 [verbose] SSL enabled on 
2021/04/30 10:21:39 [verbose] generating /usr/local/kong/ssl/kong-default.crt SSL certificate (
2021/04/30 10:21:39 [verbose] generating /usr/local/kong/ssl/kong-default-ecdsa.crt SSL certificate (
2021/04/30 10:21:39 [verbose] SSL enabled on 
2021/04/30 10:21:39 [verbose] generating /usr/local/kong/ssl/admin-kong-default.crt SSL certificate (
2021/04/30 10:21:39 [verbose] generating /usr/local/kong/ssl/admin-kong-default-ecdsa.crt SSL certificate (
2021/04/30 10:21:39 [verbose] generating ffdhe2048 DH parameters
2021/04/30 10:21:39 [debug] searching for OpenResty 'nginx' executable
2021/04/30 10:21:39 [debug] /usr/local/openresty/nginx/sbin/nginx -v: 'nginx version: openresty/1.19.3.1'
2021/04/30 10:21:39 [debug] found OpenResty 'nginx' executable at /usr/local/openresty/nginx/sbin/nginx
2021/04/30 10:21:39 [debug] testing nginx configuration: KONG_NGINX_CONF_CHECK=true /usr/local/openresty/nginx/sbin/nginx -t -p /usr/local/kong -c nginx.conf
2021/04/30 10:21:39 [debug] sending signal to pid at: /usr/local/kong/pids/nginx.pid
2021/04/30 10:21:39 [debug] kill -0 `cat /usr/local/kong/pids/nginx.pid` >/dev/null 2>&1
2021/04/30 10:21:39 [debug] loading subsystems migrations...
2021/04/30 10:21:39 [verbose] retrieving cache schema state...
2021/04/30 10:21:39 [verbose] schema state retrieved
2021/04/30 10:21:39 [debug] searching for OpenResty 'nginx' executable
2021/04/30 10:21:39 [debug] /usr/local/openresty/nginx/sbin/nginx -v: 'nginx version: openresty/1.19.3.1'
2021/04/30 10:21:39 [debug] found OpenResty 'nginx' executable at /usr/local/openresty/nginx/sbin/nginx
2021/04/30 10:21:39 [debug] sending signal to pid at: /usr/local/kong/pids/nginx.pid
2021/04/30 10:21:39 [debug] kill -0 `cat /usr/local/kong/pids/nginx.pid` >/dev/null 2>&1
2021/04/30 10:21:39 [debug] starting nginx: /usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf
2021/04/30 10:21:40 [debug] nginx started
2021/04/30 10:21:40 [info] Kong started
I0430 10:21:40.653595       1 main.go:258] subprocess exited successfully

To be honest, I don't have any idea why subprocess exits after kong starts successfully.

Any help would be appreciated!

./cloudrun.sh is the subprocess. Are you doing an exec in there.
It would be good for you to analyze the process tree you want vs you have in the container.

yes we do exec and this is the tree

  PID TTY      STAT   TIME COMMAND
    1 ?        Ssl    0:00 runsd -v=5 -- ./cloudrun.sh
   12 ?        S      0:00 /bin/bash ./cloudrun.sh
   48 ?        R      0:00  \_ ps -x --forest
   44 ?        Ss     0:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf

does it make sense?

so it seems the ./cloudrun.sh continues to run? or does it get replaced by nginx over time?

the only reason why I imagine this would happen is that ./cloudrun.sh exits (I don't think execve causes this).

I am closing let me know if you need to keep it open and please provide more details.