{"action":"created","issue":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/1527","labels_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/1527/labels{/name}","comments_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/1527/comments","events_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/1527/events","html_url":"https://github.com/wiredtiger/wiredtiger/issues/1527","id":53350382,"number":1527,"title":"__wt_clsm_open calls __clsm_close","user":{"login":"keithbostic","id":1393186,"avatar_url":"https://avatars.githubusercontent.com/u/1393186?v=3","gravatar_id":"","url":"https://api.github.com/users/keithbostic","html_url":"https://github.com/keithbostic","followers_url":"https://api.github.com/users/keithbostic/followers","following_url":"https://api.github.com/users/keithbostic/following{/other_user}","gists_url":"https://api.github.com/users/keithbostic/gists{/gist_id}","starred_url":"https://api.github.com/users/keithbostic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithbostic/subscriptions","organizations_url":"https://api.github.com/users/keithbostic/orgs","repos_url":"https://api.github.com/users/keithbostic/repos","events_url":"https://api.github.com/users/keithbostic/events{/privacy}","received_events_url":"https://api.github.com/users/keithbostic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/labels/Bug","name":"Bug","color":"e10c02"}],"state":"open","locked":false,"assignee":{"login":"agorrod","id":1930121,"avatar_url":"https://avatars.githubusercontent.com/u/1930121?v=3","gravatar_id":"","url":"https://api.github.com/users/agorrod","html_url":"https://github.com/agorrod","followers_url":"https://api.github.com/users/agorrod/followers","following_url":"https://api.github.com/users/agorrod/following{/other_user}","gists_url":"https://api.github.com/users/agorrod/gists{/gist_id}","starred_url":"https://api.github.com/users/agorrod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agorrod/subscriptions","organizations_url":"https://api.github.com/users/agorrod/orgs","repos_url":"https://api.github.com/users/agorrod/repos","events_url":"https://api.github.com/users/agorrod/events{/privacy}","received_events_url":"https://api.github.com/users/agorrod/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/milestones/35","labels_url":"https://api.github.com/repos/wiredtiger/wiredtiger/milestones/35/labels","id":913861,"number":35,"title":"2.5.1","description":"2.5.1 release","creator":{"login":"agorrod","id":1930121,"avatar_url":"https://avatars.githubusercontent.com/u/1930121?v=3","gravatar_id":"","url":"https://api.github.com/users/agorrod","html_url":"https://github.com/agorrod","followers_url":"https://api.github.com/users/agorrod/followers","following_url":"https://api.github.com/users/agorrod/following{/other_user}","gists_url":"https://api.github.com/users/agorrod/gists{/gist_id}","starred_url":"https://api.github.com/users/agorrod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agorrod/subscriptions","organizations_url":"https://api.github.com/users/agorrod/orgs","repos_url":"https://api.github.com/users/agorrod/repos","events_url":"https://api.github.com/users/agorrod/events{/privacy}","received_events_url":"https://api.github.com/users/agorrod/received_events","type":"User","site_admin":false},"open_issues":71,"closed_issues":1,"state":"open","created_at":"2014-12-24T01:42:41Z","updated_at":"2015-01-04T22:06:07Z","due_on":"2015-01-30T05:00:00Z","closed_at":null},"comments":1,"created_at":"2015-01-04T22:04:15Z","updated_at":"2015-01-04T22:51:48Z","closed_at":null,"body":"@agorrod, I had a question about `__wt_clsm_open` I didn't want to lose, so I'm creating an issue.\r\n\r\nObviously, not urgent.\r\n\r\n In `__wt_clsm_open`, there's this code:\r\n```\r\n        /* \r\n         * The tree's dsk_gen starts at one, so starting the cursor on zero\r\n         * will force a call into open_cursors on the first operation.\r\n         */\r\n        clsm->dsk_gen = 0;\r\n         \r\n        WT_STATIC_ASSERT(offsetof(WT_CURSOR_LSM, iface) == 0);\r\n        WT_ERR(__wt_cursor_init(cursor, cursor->uri, owner, cfg, cursorp));\r\n        \r\n        if (0) {\r\nerr:            __wt_lsm_tree_release(session, lsm_tree);\r\n                if (clsm != NULL) {\r\n                        clsm->lsm_tree = NULL;\r\n                        WT_TRET(__clsm_close(cursor));\r\n                }\r\n        }\r\n```\r\nThis is probably wrong, I think we should be able to call `free(clsm)` instead of `__clsm_close`; if I'm wrong, we shouldn't call `__wt_lsm_tree_release`, as `__clsm_close` does that, and in this case I think the current code would result in `__wt_lsm_tree_release` being called twice."},"comment":{"url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/comments/68653317","html_url":"https://github.com/wiredtiger/wiredtiger/issues/1527#issuecomment-68653317","issue_url":"https://api.github.com/repos/wiredtiger/wiredtiger/issues/1527","id":68653317,"user":{"login":"michaelcahill","id":1264383,"avatar_url":"https://avatars.githubusercontent.com/u/1264383?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcahill","html_url":"https://github.com/michaelcahill","followers_url":"https://api.github.com/users/michaelcahill/followers","following_url":"https://api.github.com/users/michaelcahill/following{/other_user}","gists_url":"https://api.github.com/users/michaelcahill/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcahill/subscriptions","organizations_url":"https://api.github.com/users/michaelcahill/orgs","repos_url":"https://api.github.com/users/michaelcahill/repos","events_url":"https://api.github.com/users/michaelcahill/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcahill/received_events","type":"User","site_admin":false},"created_at":"2015-01-04T22:51:48Z","updated_at":"2015-01-04T22:51:48Z","body":"I haven't looked closely, but I don't see the problem -- we clear 'clsm->lsm_tree' before calling `__clsm_close`, so there's no chance of it being called twice.  I suspect the code ended up this way to make it unambiguous that we release the tree, even if allocating the cursor handle fails."}}