zettadb / cluster_mgr

Clust_mgr is an important compnent of KunlunBase. It provides a HTTP API for KunlunBase users to do cluster management, provisioning and monitor work, so that uses can install a cluster, a kunlun-server node, a storage shard or a kunlun-storage node by calling such APIs. Such capability enables users to integrate KunlunBase management and provisioning as part of their existing application or GUIs. Cluster_mgr also provide other important cluster maintenance background work to make sure the KunlunBase clusters it serves can work efficiently and reliably.
http://www.kunlunbase.com
Apache License 2.0
10 stars 2 forks source link

Daemonize function give up closing fd set bigger than 2 #11

Closed jd-zhang closed 2 years ago

jd-zhang commented 2 years ago

Issue migrated from trac ticket # 477

component: cluster manager | priority: major | resolution: finished

2022-03-09 15:02:26: snow@zettadb.com created the issue


== Daemonize function\ Daemonize process is widly used int the long term service sence.\ To achive the object, such machanisem was desinged below:\

fork() do setsid() in child to renew session , detach from terminal set sigaction fork() do umask() in child close fd in child which bigger than 2

== special scene\ If the global variables exists and fetch a fd may equal 3 before do daemonzing operation\ When finish the daemonize func, however, the fd 3 is closed during the last step of the daemonize operations.After that, the main() refetch the fd which is assigned to 3 because of the lowest avilable FD principle.\ For now,everything is ok, excpet the global variables perform the close() on the fd 3,because it was not informed that the fd 3 is already be closed.\ If the usage of the fd 3 is related to the logger service unfortunately, error would occour like bad file descripter == How to fix Giving up to close the remained file descripter after fork()

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com changed component from DBA GUI to cluster manager

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com edited the issue description

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com set owner to snow

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com changed severity from trivial to major

jd-zhang commented 2 years ago

2022-03-09 15:29:13: snow@zettadb.com changed status from new to assigned

jd-zhang commented 2 years ago

2022-03-09 16:24:02: snow@zettadb.com edited the issue description

jd-zhang commented 2 years ago

2022-03-14 10:48:38: snow@zettadb.com edited the issue description

jd-zhang commented 2 years ago

2022-03-14 10:48:38: snow@zettadb.com changed status from assigned to accepted

jd-zhang commented 2 years ago

2022-03-28 14:28:20: snow@zettadb.com set resolution to finished

jd-zhang commented 2 years ago

2022-03-28 14:28:20: snow@zettadb.com changed status from accepted to closed