{"action":"created","issue":{"url":"https://api.github.com/repos/cvxopt/cvxopt/issues/123","repository_url":"https://api.github.com/repos/cvxopt/cvxopt","labels_url":"https://api.github.com/repos/cvxopt/cvxopt/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/cvxopt/cvxopt/issues/123/comments","events_url":"https://api.github.com/repos/cvxopt/cvxopt/issues/123/events","html_url":"https://github.com/cvxopt/cvxopt/issues/123","id":338950352,"node_id":"MDU6SXNzdWUzMzg5NTAzNTI=","number":123,"title":"Double free or corruption with CVXOPT 1.2.0","user":{"login":"stephane-caron","id":1189580,"node_id":"MDQ6VXNlcjExODk1ODA=","avatar_url":"https://avatars0.githubusercontent.com/u/1189580?v=4","gravatar_id":"","url":"https://api.github.com/users/stephane-caron","html_url":"https://github.com/stephane-caron","followers_url":"https://api.github.com/users/stephane-caron/followers","following_url":"https://api.github.com/users/stephane-caron/following{/other_user}","gists_url":"https://api.github.com/users/stephane-caron/gists{/gist_id}","starred_url":"https://api.github.com/users/stephane-caron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephane-caron/subscriptions","organizations_url":"https://api.github.com/users/stephane-caron/orgs","repos_url":"https://api.github.com/users/stephane-caron/repos","events_url":"https://api.github.com/users/stephane-caron/events{/privacy}","received_events_url":"https://api.github.com/users/stephane-caron/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-06T13:59:50Z","updated_at":"2018-07-06T18:48:39Z","closed_at":null,"author_association":"NONE","body":"I have a problem with the following LP example with ``cvxopt==1.2.0``:\r\n```python\r\nimport numpy, cvxopt, cvxopt.solvers\r\n\r\ncvxopt.solvers.options['glpk'] = {'msg_lev': 'GLP_MSG_OFF'}  # used to work with cvxopt 1.1.8\r\n\r\ndef cvxopt_solve_lp(c, G, h):\r\n    args = [cvxopt.matrix(c), cvxopt.matrix(G), cvxopt.matrix(h)]\r\n    sol = cvxopt.solvers.lp(*args, solver='glpk')\r\n    return numpy.array(sol['x']).reshape((c.shape[0],))\r\n\r\nc, G, h = -numpy.ones(10), numpy.eye(10), numpy.zeros(10)\r\nproblems = [(c, G, h)] * 2\r\nfor i, (c, G, h) in enumerate(problems):\r\n    x = cvxopt_solve_lp(c, G, h)\r\n    print \"LP %d:\" % i, x\r\n```\r\n\r\nWhen I run it, the first LP goes fine but the second yields a \"double free or corruption\" error:\r\n```bash\r\n$ python cvxopt_debug.py                                                               134 ↵\r\nLP 0: [-0. -0. -0. -0. -0. -0. -0. -0. -0. -0.]\r\nGLPK Simplex Optimizer, v4.52\r\n10 rows, 10 columns, 10 non-zeros\r\n*     0: obj =   0.000000000e+00  infeas =  0.000e+00 (0)\r\n*    10: obj =   0.000000000e+00  infeas =  0.000e+00 (0)\r\nOPTIMAL LP SOLUTION FOUND\r\n*** Error in `python': double free or corruption (!prev): 0x00000000010ad7e0 ***\r\n[1]    6857 abort (core dumped)  python cvxopt_debug.py\r\n```\r\n\r\n**Observations:**\r\n- my OS is Ubuntu 14.04, so the Python above is 2.7.6\r\n- no error with ``cvxopt==1.1.9``\r\n- error only occurs when there is more than one problem in ``problems``\r\n- error disappears when commenting out the ``'msg_lev'`` GLPK option\r\n- error disappears when inlining the body of the function inside the for loop\r\n\r\n**Bonus question:** what's the new syntax to turn of GLPK's terminal output?"},"comment":{"url":"https://api.github.com/repos/cvxopt/cvxopt/issues/comments/403117367","html_url":"https://github.com/cvxopt/cvxopt/issues/123#issuecomment-403117367","issue_url":"https://api.github.com/repos/cvxopt/cvxopt/issues/123","id":403117367,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzExNzM2Nw==","user":{"login":"martinandersen","id":921758,"node_id":"MDQ6VXNlcjkyMTc1OA==","avatar_url":"https://avatars1.githubusercontent.com/u/921758?v=4","gravatar_id":"","url":"https://api.github.com/users/martinandersen","html_url":"https://github.com/martinandersen","followers_url":"https://api.github.com/users/martinandersen/followers","following_url":"https://api.github.com/users/martinandersen/following{/other_user}","gists_url":"https://api.github.com/users/martinandersen/gists{/gist_id}","starred_url":"https://api.github.com/users/martinandersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinandersen/subscriptions","organizations_url":"https://api.github.com/users/martinandersen/orgs","repos_url":"https://api.github.com/users/martinandersen/repos","events_url":"https://api.github.com/users/martinandersen/events{/privacy}","received_events_url":"https://api.github.com/users/martinandersen/received_events","type":"User","site_admin":false},"created_at":"2018-07-06T18:48:39Z","updated_at":"2018-07-06T18:48:39Z","author_association":"CONTRIBUTOR","body":"Thanks for reporting this. I can reproduce the error on macOS. It appears to be a bug related to global options—we'll provide a fix. In the meantime you can pass options as a keyword argument:\r\n\r\n```\r\nsol = cvxopt.solvers.lp(*args, solver='glpk', options={'glpk':{'msg_lev': 'GLP_MSG_OFF'}})\r\n```"}}
{"actor":{"display_login":"martinandersen"}}