{"id":1947,"date":"2009-11-12T00:21:05","date_gmt":"2009-11-12T07:21:05","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=1947"},"modified":"2020-07-25T22:48:45","modified_gmt":"2020-07-26T05:48:45","slug":"process-of-confusion","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/","title":{"rendered":"Process of Confusion"},"content":{"rendered":"<p>I am working hard at designing a better <a href=\"http:\/\/fate.multimedia.cx\/\">FATE<\/a> right now. But first thing&#8217;s first: I&#8217;m revisiting an old problem and hoping to conclusively determine certain process-related behavior.<\/p>\n<p><a href=\"http:\/\/multimedia.cx\/eggs\/processing-those-crashers\/\">I first described the problem in this post<\/a> and claimed in <a href=\"http:\/\/multimedia.cx\/eggs\/fates-further-evolution\/\">this post that I had hacked around the problem.<\/a> Here&#8217;s the thing: When I spin off a new process to run an FFmpeg command line, Python&#8217;s process object specifies a PID. Who does this PID belong to? The natural assumption would be that it belongs to FFmpeg. However, I learned empirically that it actually belongs to a shell interpreter that is launching the FFmpeg command line, which has a PID 1 greater than the shell interpreter. So my quick and dirty solution was to assume that the actual FFmpeg PID was 1 greater than the PID returned from Python&#8217;s subprocess.Popen() call.<\/p>\n<p><em>Bad assumption.<\/em> The above holds true for Linux but not for Mac OS X, where the FFmpeg command line has the returned PID. I&#8217;m not sure what Windows does.<\/p>\n<p>This all matters for the timeout killer. FATE guards against the possibility of infinite loops by specifying a timeout for each test. Timeouts don&#8217;t do much good when they trigger TERM and KILL signals to the wrong PID. I tested my process runner carefully when first writing FATE (on Linux) and everything worked okay with using the same PID returned by the API. I think that was because I was testing the process runner using the built-in &#8216;sleep&#8217; shell command. This time, I wrote a separate program called &#8216;hangaround&#8217; that takes a number of seconds to hang around before exiting. This is my testing methodology:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/multimediamike\/f0edc5b992c50b9333f8f56d92a1a359.js\"><\/script><\/p>\n<p>From another command line:<\/p>\n<pre>\r\n$ ps ax|grep hangaround\r\n21433 pts\/2    S+     0:00 \/bin\/sh -c .\/hangaround 30\r\n21434 pts\/2    S+     0:00 .\/hangaround 30\r\n21436 pts\/0    R+     0:00 grep hangaround\r\n<\/pre>\n<p>That&#8217;s Linux; for Mac OS X:<\/p>\n<pre>\r\n>>> process.pid\r\n82079\r\n\r\n$ ps ax|grep hangaround\r\n82079 s005  S+     0:00.01 .\/hangaround 30\r\n82084 s006  R+     0:00.00 grep hangaround\r\n<\/pre>\n<p>So, the upshot is that I&#8217;m a little confused about how I&#8217;m going to create a general solution to work around this problem&#8211; a problem that doesn&#8217;t occur very often but makes FATE fail hard when it does show up.<\/p>\n<p><strong>Followup:<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/multimedia.cx\/eggs\/process-runner-redux\/\">Process Runner Redux<\/a>: Making some hard decisions regarding these problems<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to code around some PID weirdness<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,55],"tags":[],"class_list":["post-1947","post","type-post","status-publish","format-standard","hentry","category-fate-server","category-python"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"I&#039;m trying to code around some PID weirdness\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Process of Confusion | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"I&#039;m trying to code around some PID weirdness\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-11-12T07:21:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-07-26T05:48:45+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Process of Confusion | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I&#039;m trying to code around some PID weirdness\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#article\",\"name\":\"Process of Confusion | Breaking Eggs And Making Omelettes\",\"headline\":\"Process of Confusion\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2009-11-12T00:21:05-08:00\",\"dateModified\":\"2020-07-25T22:48:45-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":20,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#webpage\"},\"articleSection\":\"FATE Server, Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#listItem\",\"name\":\"Process of Confusion\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#listItem\",\"position\":3,\"name\":\"Process of Confusion\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/\",\"name\":\"Process of Confusion | Breaking Eggs And Making Omelettes\",\"description\":\"I'm trying to code around some PID weirdness\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-of-confusion\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2009-11-12T00:21:05-08:00\",\"dateModified\":\"2020-07-25T22:48:45-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Process of Confusion | Breaking Eggs And Making Omelettes","description":"I'm trying to code around some PID weirdness","canonical_url":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#article","name":"Process of Confusion | Breaking Eggs And Making Omelettes","headline":"Process of Confusion","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2009-11-12T00:21:05-08:00","dateModified":"2020-07-25T22:48:45-07:00","inLanguage":"en-US","commentCount":20,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#webpage"},"articleSection":"FATE Server, Python"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","name":"Python"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","position":2,"name":"Python","item":"https:\/\/multimedia.cx\/eggs\/category\/python\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#listItem","name":"Process of Confusion"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#listItem","position":3,"name":"Process of Confusion","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","name":"Python"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/","name":"Process of Confusion | Breaking Eggs And Making Omelettes","description":"I'm trying to code around some PID weirdness","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2009-11-12T00:21:05-08:00","dateModified":"2020-07-25T22:48:45-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"Process of Confusion | Breaking Eggs And Making Omelettes","og:description":"I'm trying to code around some PID weirdness","og:url":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/","article:published_time":"2009-11-12T07:21:05+00:00","article:modified_time":"2020-07-26T05:48:45+00:00","twitter:card":"summary","twitter:title":"Process of Confusion | Breaking Eggs And Making Omelettes","twitter:description":"I'm trying to code around some PID weirdness"},"aioseo_meta_data":{"post_id":"1947","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 22:01:17","updated":"2025-12-31 19:16:40","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/python\/\" title=\"Python\">Python<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tProcess of Confusion\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"Python","link":"https:\/\/multimedia.cx\/eggs\/category\/python\/"},{"label":"Process of Confusion","link":"https:\/\/multimedia.cx\/eggs\/process-of-confusion\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=1947"}],"version-history":[{"count":9,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1947\/revisions"}],"predecessor-version":[{"id":4600,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1947\/revisions\/4600"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=1947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=1947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=1947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}