Project

General

Profile

Bug #7928

Add support for SMF_EXIT_NODAEMON

Added by Andrew Stormont over 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2019-02-25
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Difficulty:
Medium
Tags:

Description

Services with "contract" duration may exit with SMF_EXIT_TEMP_TRANSIENT to indicate that they are temporarily transient and should not be put into maintenance mode on the basis that they have left no child processes behind.


Subtasks

Bug #10451: smf_method(5) man page needs updates after 7928ClosedAndy Fiddaman

Actions

History

#1

Updated by Andy Fiddaman 7 months ago

Andy - are you still planning to do this work? OmniOS and SmartOS have this feature and I'd like to upstream it to gate.

#2

Updated by Andrew Stormont 7 months ago

I have no plans to upstream this. Feel free to move ahead with your fix.

#3

Updated by Andy Fiddaman 7 months ago

  • Subject changed from Add support for SMF_EXIT_TEMP_TRANSIENT to Add support for SMF_EXIT_NODAEMON
  • Assignee changed from Andrew Stormont to Andy Fiddaman
  • Start date changed from 2017-03-02 to 2019-02-20
  • Tags deleted (needs-triage)
#4

Updated by Andy Fiddaman 7 months ago

An example of this is the datalink-management service whose method contains:

if smf_is_nonglobalzone; then
    (while true ; do sleep 3600 ; done) & 
    exit $SMF_EXIT_OK
fi

and in an NGZ:

root@hawkeye:~# ps -ef | grep dlm
    root  4513  4302   0   Jan 22 ?           0:00 /sbin/sh /lib/svc/method/svc-dlmgmtd

root@hawkeye:~# pstack 4513
4513:   /sbin/sh /lib/svc/method/svc-dlmgmtd
 feeec3e7 pause    ()
 fed67c98 sleep    (e10, 0, ffffffff, fed67d5d, 0, 40ac2000) + 8a
 fed67da5 sh_delay (0, 40ac2000, 15, fed68195) + 55
 fed681b3 b_sleep  (2, 80afd98, fedef164, 0, 90a7369, 0) + 39d
 fedb9d6b sh_exec  (80afd50, 4, 80472cc, fedb8d86, 80472f4, fec00e00) + ff6
 fedbbba7 sh_exec  (80afcd4, 85, 8047678, fedbab50) + 2e32
 fedbab67 sh_exec  (80afdb4, 4, 80afc6c, fedb8d86, 80b2058, 0) + 1df2
 fedbb36e sh_exec  (80afe18, 4, 2, fedb8d86, 0, 0) + 25f9
 fedbbeeb sh_exec  (80afc3c, 24, 0, fed9835e) + 3176
 fed9859e exfile   (fedeee80, 80bac40) + 7c9
 fed9900c sh_main  (2, 8047de0, 0, 0) + 889
 08051040 main     (fedf0140, fef67388, 8047db8, 8050f08, 2, 8047de0) + 56
 08050f08 _start_crt (2, 8047de0, fefd0d40, 0, 0, 0) + 97
 08050dda _start   (2, 8047ec8, 8047ed1, 0, 8062260, 8047f11) + 1a

With this change, the service method can exit SMF_EXIT_NODAEMON which satisfies all dependencies and does not leave a process hanging around.

#6

Updated by Electric Monk 7 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit f18d8787c0ba765f61b003e2aae78db90b48f833

commit  f18d8787c0ba765f61b003e2aae78db90b48f833
Author: Jerry Jelinek <jerry.jelinek@joyent.com>
Date:   2019-02-22T15:50:43.000Z

    7928 Add support for SMF_EXIT_NODAEMON
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF