{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/15658","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/15658/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/15658/comments","events_url":"https://api.github.com/repos/golang/go/issues/15658/events","html_url":"https://github.com/golang/go/issues/15658","id":154383450,"number":15658,"title":"runtime: FreeBSD memory corruption involving fork system call","user":{"login":"derekmarcotte","id":12298521,"avatar_url":"https://avatars2.githubusercontent.com/u/12298521?v=3","gravatar_id":"","url":"https://api.github.com/users/derekmarcotte","html_url":"https://github.com/derekmarcotte","followers_url":"https://api.github.com/users/derekmarcotte/followers","following_url":"https://api.github.com/users/derekmarcotte/following{/other_user}","gists_url":"https://api.github.com/users/derekmarcotte/gists{/gist_id}","starred_url":"https://api.github.com/users/derekmarcotte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekmarcotte/subscriptions","organizations_url":"https://api.github.com/users/derekmarcotte/orgs","repos_url":"https://api.github.com/users/derekmarcotte/repos","events_url":"https://api.github.com/users/derekmarcotte/events{/privacy}","received_events_url":"https://api.github.com/users/derekmarcotte/received_events","type":"User","site_admin":false},"labels":[{"id":373402289,"url":"https://api.github.com/repos/golang/go/labels/NeedsInvestigation","name":"NeedsInvestigation","color":"ededed","default":false},{"id":199752924,"url":"https://api.github.com/repos/golang/go/labels/OS-FreeBSD","name":"OS-FreeBSD","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"aclements","id":2688315,"avatar_url":"https://avatars3.githubusercontent.com/u/2688315?v=3","gravatar_id":"","url":"https://api.github.com/users/aclements","html_url":"https://github.com/aclements","followers_url":"https://api.github.com/users/aclements/followers","following_url":"https://api.github.com/users/aclements/following{/other_user}","gists_url":"https://api.github.com/users/aclements/gists{/gist_id}","starred_url":"https://api.github.com/users/aclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclements/subscriptions","organizations_url":"https://api.github.com/users/aclements/orgs","repos_url":"https://api.github.com/users/aclements/repos","events_url":"https://api.github.com/users/aclements/events{/privacy}","received_events_url":"https://api.github.com/users/aclements/received_events","type":"User","site_admin":false},"assignees":[{"login":"aclements","id":2688315,"avatar_url":"https://avatars3.githubusercontent.com/u/2688315?v=3","gravatar_id":"","url":"https://api.github.com/users/aclements","html_url":"https://github.com/aclements","followers_url":"https://api.github.com/users/aclements/followers","following_url":"https://api.github.com/users/aclements/following{/other_user}","gists_url":"https://api.github.com/users/aclements/gists{/gist_id}","starred_url":"https://api.github.com/users/aclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclements/subscriptions","organizations_url":"https://api.github.com/users/aclements/orgs","repos_url":"https://api.github.com/users/aclements/repos","events_url":"https://api.github.com/users/aclements/events{/privacy}","received_events_url":"https://api.github.com/users/aclements/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/49","html_url":"https://github.com/golang/go/milestone/49","labels_url":"https://api.github.com/repos/golang/go/milestones/49/labels","id":2053058,"number":49,"title":"Go1.9","description":"","creator":{"login":"rsc","id":104030,"avatar_url":"https://avatars2.githubusercontent.com/u/104030?v=3","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":415,"closed_issues":434,"state":"open","created_at":"2016-10-06T18:17:55Z","updated_at":"2017-05-26T19:25:25Z","due_on":"2017-07-31T07:00:00Z","closed_at":null},"comments":208,"created_at":"2016-05-12T02:24:56Z","updated_at":"2017-05-28T18:45:31Z","closed_at":null,"body":"Please answer these questions before submitting your issue. Thanks!\n1. What version of Go are you using (`go version`)?\n\n`go version go1.6.2 freebsd/amd64`\n1. What operating system and processor architecture are you using (`go env`)?\n\n``` bash\nGOARCH=\"amd64\"\nGOBIN=\"\"\nGOEXE=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"freebsd\"\nGOOS=\"freebsd\"\nGOPATH=\"\"\nGORACE=\"\"\nGOROOT=\"/usr/local/go\"\nGOTOOLDIR=\"/usr/local/go/pkg/tool/freebsd_amd64\"\nGO15VENDOREXPERIMENT=\"1\"\nCC=\"cc\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0\"\nCXX=\"clang++\"\n```\n1. What did you do?\n\n``` go\npackage main\n\n/* stdlib includes */\nimport (\n        \"fmt\"\n        \"os/exec\"\n)\n\nfunc run(done chan struct{}) {\n        cmd := exec.Command(\"true\")\n        if err := cmd.Start(); err != nil {\n                goto finished\n        }\n\n        cmd.Wait()\n\nfinished:\n        done <- struct{}{}\n        return\n}\n\nfunc main() {\n        fmt.Println(\"Starting a bunch of goroutines...\")\n\n        // 8 & 16 are arbitrary\n        done := make(chan struct{}, 16)\n\n        for i := 0; i < 8; i++ {\n                go run(done)\n        }\n\n        for {\n                select {\n                case <-done:\n                        go run(done)\n                }\n        }\n}\n```\n1. What did you expect to see?\n\nI expect this strange program to spawn instances of /bin/true in parallel, until I stop it.\n1. What did you see instead?\n\nVarious types of panics caused by what looks to be corruption within the finalizer lists, caused by what I am assuming is based on race conditions.  These panics can happen as quickly as 2 minutes, or much longer.  10 minutes seems a good round number.\n\nOccasionally addspecial gets stuck in an infinite loop holding the lock, and the process wedges.  This is illustrated in log 1462933614, with x.next pointing to x.  This appears to be corruption of that data structure.  I have seen processes in this state run for 22 hours.\n\nI understand there is some trepidation expressed in issue #11485 around the locking of the data structures involved.\n\nHere are some sample messages:\n- `fatal error: runtime.SetFinalizer: finalizer already set`\n- `runtime: nonempty check fails b.log[0]= 0 b.log[1]= 0 b.log[2]= 0 b.log[3]= 0\n  fatal error: workbuf is empty`\n\n[1462926841-SetFinalizer-ex1.txt](https://github.com/golang/go/files/260514/1462926841-SetFinalizer-ex1.txt)\n[1462926969-SetFinalizer-ex2.txt](https://github.com/golang/go/files/260516/1462926969-SetFinalizer-ex2.txt)\n[1462933295-nonempty-check-fails.txt](https://github.com/golang/go/files/260517/1462933295-nonempty-check-fails.txt)\n[1462933614-wedged.txt](https://github.com/golang/go/files/260515/1462933614-wedged.txt)\n\nThis was run on an 8-core processor, and a 4-core 8-thread processor with ECC RAM, similar results.\n\nAdditionally, while this example is an extreme, it also represents the core functionality of a project I've been working on part-time for many months.  I'm happy to provide any further assistance diagnosing this issue - I'm very invested!\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/304532635","html_url":"https://github.com/golang/go/issues/15658#issuecomment-304532635","issue_url":"https://api.github.com/repos/golang/go/issues/15658","id":304532635,"user":{"login":"stevenh","id":104239,"avatar_url":"https://avatars2.githubusercontent.com/u/104239?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenh","html_url":"https://github.com/stevenh","followers_url":"https://api.github.com/users/stevenh/followers","following_url":"https://api.github.com/users/stevenh/following{/other_user}","gists_url":"https://api.github.com/users/stevenh/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenh/subscriptions","organizations_url":"https://api.github.com/users/stevenh/orgs","repos_url":"https://api.github.com/users/stevenh/repos","events_url":"https://api.github.com/users/stevenh/events{/privacy}","received_events_url":"https://api.github.com/users/stevenh/received_events","type":"User","site_admin":false},"created_at":"2017-05-28T18:45:31Z","updated_at":"2017-05-28T18:45:31Z","body":"The kernel code underneath fork is he same as vfork so unlikely"}}
{"actor":{"display_login":"stevenh"}}