{"action":"closed","issue":{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1179","repository_url":"https://api.github.com/repos/cooperative-computing-lab/cctools","labels_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1179/labels{/name}","comments_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1179/comments","events_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1179/events","html_url":"https://github.com/cooperative-computing-lab/cctools/issues/1179","id":138598379,"number":1179,"title":"Racing file descriptor table modifications with clone may cause an assertion failure in Parrot","user":{"login":"batrick","id":548304,"avatar_url":"https://avatars.githubusercontent.com/u/548304?v=3","gravatar_id":"","url":"https://api.github.com/users/batrick","html_url":"https://github.com/batrick","followers_url":"https://api.github.com/users/batrick/followers","following_url":"https://api.github.com/users/batrick/following{/other_user}","gists_url":"https://api.github.com/users/batrick/gists{/gist_id}","starred_url":"https://api.github.com/users/batrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/batrick/subscriptions","organizations_url":"https://api.github.com/users/batrick/orgs","repos_url":"https://api.github.com/users/batrick/repos","events_url":"https://api.github.com/users/batrick/events{/privacy}","received_events_url":"https://api.github.com/users/batrick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/labels/Parrot","name":"Parrot","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-04T21:59:57Z","updated_at":"2016-03-08T03:13:26Z","closed_at":"2016-03-08T03:13:26Z","body":"@annawoodard reported an assertion failure in Parrot:\r\n\r\n````\r\ntsetparrot: pfs_table.cc:157[HEAD:3b27b153]: Assertion 'fd == rfd ||\r\n((0 <= rfd && rfd < pointer_count) && pointers[rfd] == __     null)'\r\nfailed.\r\n````\r\n\r\nAn excerpt from a debug log:\r\n\r\n````\r\n2016/03/04 14:52:19.22 parrot_run[18430] <child:20111> debug: diverting to openat(4094, `pfs@-var-condo...lper.so.Wm9vJA', O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR)\r\n2016/03/04 14:52:19.22 parrot_run[18430] process: waiting for blocking event from process 20111\r\nsetparrot: pfs_table.cc:157[HEAD:3b27b153]: Assertion 'fd == rfd || ((0 <= rfd && rfd < pointer_count) && pointers[rfd] == __null)' failed.\r\n2016/03/04 14:52:19.22 parrot_run[18430] <child:20111> notice: received signal 6 (Aborted), killing all my children...\r\n````\r\n\r\nThe actual problem goes back to an earlier clone of 20111:\r\n\r\n````\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:20110> syscall: fcntl\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:20110> debug: fallthrough fcntl(12, 2, 1)\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:19174> syscall: = 0 [rt_sigprocmask]\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:19174> syscall: clone\r\n2016/03/04 14:52:19.05 parrot_run[18430] process: waiting for blocking event from process 19174\r\n2016/03/04 14:52:19.05 parrot_run[18430] process: pid 19174 cloned 20111\r\n2016/03/04 14:52:19.05 parrot_run[18430] debug: increasing refcount to 13 for channel `/lib64/libtinfo.so.5.7':36000:135168\r\n2016/03/04 14:52:19.05 parrot_run[18430] debug: increasing refcount to 14 for channel `/lib64/libtinfo.so.5.7':36000:135168\r\n...\r\n2016/03/04 14:52:19.05 parrot_run[18430] pstree: 19174 fork 20111\r\n2016/03/04 14:52:19.05 parrot_run[18430] process: pid 20111 received signal 19 (Stopped (signal)) (state 1)\r\n2016/03/04 14:52:19.05 parrot_run[18430] debug: suppressing bootstrap SIGSTOP for 20111\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:20110> debug: updating native fd 12 flags to 1\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:20110> debug: setting fd 12 as native (FD_CLOEXEC)\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:20110> syscall: = 0 [fcntl]\r\n2016/03/04 14:52:19.05 parrot_run[18430] <child:19174> syscall: = 20111 [clone]\r\n````\r\n\r\n20110 is a racing thread with 19174. 20110 is attempting to set `FD_CLOEXEC` on a file descriptor (shared with 19174). The newly cloned **process** 20111 may or may not have the change to the fd table by 20110.\r\n\r\nThe reason for the assertion failure is that Parrot expects its version of the file descriptor table to be in sync with the kernel. Unfortunately, this is tricky to fix. I'm not yet sure what the right approach is."}}