[JIRA] [durable-task-plugin] (JENKINS-25503) Use setsid instead of nohup

13 views
Skip to first unread message

rodrigc@FreeBSD.org (JIRA)

unread,
Jan 3, 2016, 3:56:02 PM1/3/16
to jenkinsc...@googlegroups.com
Craig Rodrigues commented on Bug JENKINS-25503
 
Re: Use setsid instead of nohup

Jesse Glick What do you mean by it?
MacOS X has the setsid() function in libc, but not a setsid command-line utility.

MacOS X 10.10.5 has this in /usr/bin:

-rwxr-xr-x  2 root  wheel  58416 Jul 14 22:53 /usr/bin/python
-rwxr-xr-x  5 root  wheel    925 Sep  9  2014 /usr/bin/python-config
lrwxr-xr-x  1 root  wheel     75 Mar 12  2015 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x  1 root  wheel     82 Mar 12  2015 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x  1 root  wheel     75 Mar 12  2015 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel     82 Mar 12  2015 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x  2 root  wheel  58416 Jul 14 22:53 /usr/bin/pythonw
lrwxr-xr-x  1 root  wheel     76 Mar 12  2015 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x  1 root  wheel     76 Mar 12  2015 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

rodrigc@FreeBSD.org (JIRA)

unread,
Jan 3, 2016, 3:57:04 PM1/3/16
to jenkinsc...@googlegroups.com
Craig Rodrigues edited a comment on Bug JENKINS-25503
[~jglick] What do you mean by *it*?

MacOS X has the setsid() function in libc, but not a setsid command-line utility.

For Python, MacOS X 10.10.5 has this in /usr/bin:

{code}

-rwxr-xr-x  2 root  wheel  58416 Jul 14 22:53 /usr/bin/python
-rwxr-xr-x  5 root  wheel    925 Sep  9  2014 /usr/bin/python-config
lrwxr-xr-x  1 root  wheel     75 Mar 12  2015 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x  1 root  wheel     82 Mar 12  2015 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x  1 root  wheel     75 Mar 12  2015 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel     82 Mar 12  2015 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x  2 root  wheel  58416 Jul 14 22:53 /usr/bin/pythonw
lrwxr-xr-x  1 root  wheel     76 Mar 12  2015 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x  1 root  wheel     76 Mar 12  2015 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
{code}

rodrigc@FreeBSD.org (JIRA)

unread,
Mar 30, 2017, 2:49:03 PM3/30/17
to jenkinsc...@googlegroups.com

Kohsuke Kawaguchi I'm still having tons of problems with durable task plugin due to this problem.  I think setsid is the way to go on this.

The idea to write a setsid.py wrapper in Python is intriguing.  It would definitely work.

My concern is that now Python becomes a core dependency for running Jenkins Pipeline.

I have no problem with that because I love Python and use Python heavily in my projects.

However, from a devops perspective this might be a problem because people now need to add Python to their dependencies for running Jenkins.  This becomes more interesting as more Jenkins deployments are running in a dockerized type of world.

Would it be possible to write a small setsid wrapper in JNA?

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

rodrigc@FreeBSD.org (JIRA)

unread,
Mar 30, 2017, 5:49:01 PM3/30/17
to jenkinsc...@googlegroups.com

vivek.pandey@gmail.com (JIRA)

unread,
Nov 16, 2018, 12:50:03 PM11/16/18
to jenkinsc...@googlegroups.com
Vivek Pandey updated an issue
 
Jenkins / Bug JENKINS-25503
Change By: Vivek Pandey
Labels: pipeline triaged-2018-11
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Apr 17, 2019, 12:00:08 PM4/17/19
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-25503
 
Re: Use setsid instead of nohup

The advantages of Golang for this purpose are clear: small size; fast startup; static linking to minimize the chance of divergent runtime behaviors; access to platform-dependent system APIs like this one; and of course the availability of cross-compilation so we could have a Dockerized build process creating binaries for all supported platforms (whatever subset of go tool dist list) at once.

There will however still be some exotic platforms not supported by Golang, such as z/OS, and probably some cases where sh is being used in a semi-POSIX environment like Cygwin that might choke on lower-level calls. So I think the current shell wrapper still needs to be available as a fallback (not sure how you decide when to use it) and given some smoke test coverage, though it could be stripped of all its advanced features like PID tracking.

jglick@cloudbees.com (JIRA)

unread,
Jul 1, 2019, 7:41:03 PM7/1/19
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Unassigned
 
Change By: Jesse Glick
Assignee: Jesse Glick

jglick@cloudbees.com (JIRA)

unread,
Sep 10, 2019, 3:47:03 PM9/10/19
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Carroll Chiou
Change By: Jesse Glick
Assignee: Carroll Chiou
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Sep 10, 2019, 3:48:04 PM9/10/19
to jenkinsc...@googlegroups.com
Jesse Glick started work on Bug JENKINS-25503
 
Change By: Jesse Glick
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Sep 10, 2019, 3:48:04 PM9/10/19
to jenkinsc...@googlegroups.com

cchiou@cloudbees.com (JIRA)

unread,
Oct 22, 2019, 4:20:06 PM10/22/19
to jenkinsc...@googlegroups.com
Change By: Carroll Chiou
Status: Fixed but Unreleased Resolved

cchiou@cloudbees.com (JIRA)

unread,
Oct 22, 2019, 4:20:06 PM10/22/19
to jenkinsc...@googlegroups.com
 

Shell wrapper script has now been replaced by pre-compiled golang binaries (for Unix and Darwin). The binary allows the script to have its own session id and removes some polling overhead. This should increase the survivability of long-running scripts when jenkins terminates unexpectedly. This does not change the survivability of the script when the underlying environment decides to terminate processes due to things like low memory.
Note: Outside of *NIX systems, the behavior is unchanged.

The binary itself is ~2.5MB per binary. There are 4 pre-compiled binaries (32 and 64bit versions for unix and darwin) while the memory footprint is ~800KB heavier than the shell wrapper.
Here is a high-level breakdown of the memory footprint:
Original version:
two wrapper shell processes that are spawned, each process between 610-640KB
a single 548KB sleep process used to poll the log output file
Go binary version:
a single golang binary ~2560KB

Change By: Carroll Chiou
Status: In Review Fixed but Unreleased
Resolution: Fixed
Released As: durable-task 1.31
Reply all
Reply to author
Forward
0 new messages