ugly "pthread_create failed: Resource temporarily unavailable" running snaps

Bug #1681294 reported by Michael Hudson-Doyle on 2017-04-10
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
golang-1.6 (Ubuntu)
Undecided
Unassigned
Xenial
Undecided
Michael Hudson-Doyle
Yakkety
Undecided
Michael Hudson-Doyle
golang-1.7 (Ubuntu)
Undecided
Unassigned

Bug Description

[Impact]
As reported here: https://lists.ubuntu.com/archives/snapcraft/2017-March/003497.html (and on internal lists), it is possible for a golang executable that calls syscall.Exec to print an ugly "pthread_create failed: Resource temporarily unavailable" message before it starts the new process. There is no functional effect, but snapd runs into this frequently so it interferes with a nice snappy experience.

Luckily for us, the bug was fixed upstream in the 1.8 release (https://github.com/golang/go/issues/18146) so I can just backport the fix to Xenial and Yakkety.

It also turns out to be necessary to include two more upstream patches that fix test suite failures with new tzdata packages.

[Test case]
Run this code:

package main

//
import "C"

import (
 "syscall"
)

func main() {
 syscall.Exec("/bin/true", []string{"/bin/true"}, nil)
}

a few thousand times and check for messages (it prints a message ~2% of the time or so without the fix).

[Regression potential]
The patch is simple, if a bit verbose (it has some per-architecture changes). It has not been the cause of any bug reports in 1.8 as far as I am aware. So I would characterise the regression potential as very low.

The tzdata patches are similarly well exercised as they are backports, and are necessary or the build will fail!

Changed in golang-1.6 (Ubuntu Xenial):
assignee: nobody → Michael Hudson-Doyle (mwhudson)
Changed in golang-1.6 (Ubuntu Yakkety):
assignee: nobody → Michael Hudson-Doyle (mwhudson)
no longer affects: golang-1.7 (Ubuntu Yakkety)
no longer affects: golang-1.7 (Ubuntu Xenial)
Changed in golang-1.6 (Ubuntu):
status: New → Invalid
description: updated
Changed in golang-1.6 (Ubuntu Xenial):
status: New → In Progress
Changed in golang-1.6 (Ubuntu Yakkety):
status: New → In Progress
Łukasz Zemczak (sil2100) wrote :

It's a rather big change for a non-functional issue - by big I mean this change *could* potentially affect all the places where pthread_create was normally called. But seeing that the change had some testing time already and considering how this affects the snappy user experience, I'll be accepting the packages to the stable releases.

Changed in golang-1.6 (Ubuntu Yakkety):
status: In Progress → Fix Committed

Hello Michael, or anyone else affected,

Accepted golang-1.6 into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/golang-1.6/1.6.3-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Łukasz Zemczak (sil2100) wrote :

Waiting with the xenial upload as the yakkety one seems to have FTBFS on some archs. Michael said he'll fix that - don't want to risk the xenial upload in this case.

Michael Hudson-Doyle (mwhudson) wrote :

I've fixed that and uploaded new versions.

Łukasz Zemczak (sil2100) wrote :

Hello Michael, or anyone else affected,

Accepted golang-1.6 into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/golang-1.6/1.6.3-1ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Łukasz Zemczak (sil2100) wrote :

Hello Michael, or anyone else affected,

Accepted golang-1.6 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/golang-1.6/1.6.2-0ubuntu5~16.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in golang-1.6 (Ubuntu Xenial):
status: In Progress → Fix Committed
Steve Langasek (vorlon) on 2017-04-18
Changed in golang-1.6 (Ubuntu Yakkety):
status: Fix Committed → Won't Fix
Michael Hudson-Doyle (mwhudson) wrote :

It turns out that the new golang-1.6 breaks ABI (thanks to an upstream bug I've now fixed, but that's no help here) and so would require rebuilding a chain of dependencies to make yakkety-proposed installable again. This doesn't seem worth the effort for this bug, so we've removed the package from yakkety-proposed.

Michael Hudson-Doyle (mwhudson) wrote :

That said, the package from xenial-proposed does work fine (the test case program produces no output when run 100000 times). I also used the proposed package to rebuild lxd and gave the rebuilt packages a quick test and they worked fine too.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package golang-1.6 - 1.6.2-0ubuntu5~16.04.2

---------------
golang-1.6 (1.6.2-0ubuntu5~16.04.2) xenial; urgency=medium

  * Fix build on ppc64el.

golang-1.6 (1.6.2-0ubuntu5~16.04.1) xenial; urgency=medium

  * Backport fix for ugly "pthread_create failed: Resource temporarily
    unavailable" message when calling syscall.Exec. (LP: #1681294)
  * Backport CL 29995 for tzdata 2016g changes.
  * Backport CL 37964 for tzdata 2017a changes.

 -- Michael Hudson-Doyle <email address hidden> Wed, 12 Apr 2017 14:42:48 +1200

Changed in golang-1.6 (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for golang-1.6 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers