{"action":"created","issue":{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1367","repository_url":"https://api.github.com/repos/cooperative-computing-lab/cctools","labels_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1367/labels{/name}","comments_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1367/comments","events_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1367/events","html_url":"https://github.com/cooperative-computing-lab/cctools/pull/1367","id":158366371,"number":1367,"title":"Batch job option fix","user":{"login":"nhazekam","id":5231159,"avatar_url":"https://avatars.githubusercontent.com/u/5231159?v=3","gravatar_id":"","url":"https://api.github.com/users/nhazekam","html_url":"https://github.com/nhazekam","followers_url":"https://api.github.com/users/nhazekam/followers","following_url":"https://api.github.com/users/nhazekam/following{/other_user}","gists_url":"https://api.github.com/users/nhazekam/gists{/gist_id}","starred_url":"https://api.github.com/users/nhazekam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhazekam/subscriptions","organizations_url":"https://api.github.com/users/nhazekam/orgs","repos_url":"https://api.github.com/users/nhazekam/repos","events_url":"https://api.github.com/users/nhazekam/events{/privacy}","received_events_url":"https://api.github.com/users/nhazekam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-03T13:24:33Z","updated_at":"2016-06-03T14:07:05Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/pulls/1367","html_url":"https://github.com/cooperative-computing-lab/cctools/pull/1367","diff_url":"https://github.com/cooperative-computing-lab/cctools/pull/1367.diff","patch_url":"https://github.com/cooperative-computing-lab/cctools/pull/1367.patch"},"body":"This waits to free until after we have made a duplicate of the new value. This prevents an issue if the old value passed back in. e.g. as in Makeflow\r\n\r\nprevious = batch_queue_get_option (q, \"batch-options\");\r\nif(new-options)\r\n    batch_queue_set_option(q, \"batch-options\", new-options);\r\n\r\nrun task\r\n\r\nif(previous)\r\n    batch_queue_set_option(q, \"batch-options\", previous);\r\n\r\nSet option duplicates the passed value, and removes the previous value. When removing the previous value, it also frees that value as batch_job created it in the first place. The issue occurs when you pass back in the original value that you retrieved and it has already been freed. This happens regardless of whether you set new options or not. \r\n\r\nThis pull request still frees the internal copy when a new value is set. It also returns a copy on get so we don't have issues if a new value is set while a pointer is held.\r\n\r\nInstead of the solution here we could respect const char and not strdup the value, relieving the need to free at all in batch options. \r\n\r\nBefore this is merged I need to go through and make sure memory leaks weren't added by strdup on get_option and feature.\r\n\r\nDefinitely open to a better solution, but this works in SLURM. @btovar @dthain "},"comment":{"url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/comments/223588153","html_url":"https://github.com/cooperative-computing-lab/cctools/pull/1367#issuecomment-223588153","issue_url":"https://api.github.com/repos/cooperative-computing-lab/cctools/issues/1367","id":223588153,"user":{"login":"nhazekam","id":5231159,"avatar_url":"https://avatars.githubusercontent.com/u/5231159?v=3","gravatar_id":"","url":"https://api.github.com/users/nhazekam","html_url":"https://github.com/nhazekam","followers_url":"https://api.github.com/users/nhazekam/followers","following_url":"https://api.github.com/users/nhazekam/following{/other_user}","gists_url":"https://api.github.com/users/nhazekam/gists{/gist_id}","starred_url":"https://api.github.com/users/nhazekam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhazekam/subscriptions","organizations_url":"https://api.github.com/users/nhazekam/orgs","repos_url":"https://api.github.com/users/nhazekam/repos","events_url":"https://api.github.com/users/nhazekam/events{/privacy}","received_events_url":"https://api.github.com/users/nhazekam/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T14:07:05Z","updated_at":"2016-06-03T14:07:05Z","body":"@btovar How does that look."}}
{"actor":{"display_login":"nhazekam"}}