{"action":"created","issue":{"url":"https://api.github.com/repos/igraph/python-igraph/issues/4","labels_url":"https://api.github.com/repos/igraph/python-igraph/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/igraph/python-igraph/issues/4/comments","events_url":"https://api.github.com/repos/igraph/python-igraph/issues/4/events","html_url":"https://github.com/igraph/python-igraph/issues/4","id":54382621,"number":4,"title":"Segmentation Fault under Python Django Dev Server","user":{"login":"gaborcsardi","id":660288,"avatar_url":"https://avatars.githubusercontent.com/u/660288?v=3","gravatar_id":"","url":"https://api.github.com/users/gaborcsardi","html_url":"https://github.com/gaborcsardi","followers_url":"https://api.github.com/users/gaborcsardi/followers","following_url":"https://api.github.com/users/gaborcsardi/following{/other_user}","gists_url":"https://api.github.com/users/gaborcsardi/gists{/gist_id}","starred_url":"https://api.github.com/users/gaborcsardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaborcsardi/subscriptions","organizations_url":"https://api.github.com/users/gaborcsardi/orgs","repos_url":"https://api.github.com/users/gaborcsardi/repos","events_url":"https://api.github.com/users/gaborcsardi/events{/privacy}","received_events_url":"https://api.github.com/users/gaborcsardi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/igraph/python-igraph/labels/Fix+Committed","name":"Fix Committed","color":"ededed"},{"url":"https://api.github.com/repos/igraph/python-igraph/labels/Medium","name":"Medium","color":"ededed"},{"url":"https://api.github.com/repos/igraph/python-igraph/labels/Python","name":"Python","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"ntamas","id":195637,"avatar_url":"https://avatars.githubusercontent.com/u/195637?v=3","gravatar_id":"","url":"https://api.github.com/users/ntamas","html_url":"https://github.com/ntamas","followers_url":"https://api.github.com/users/ntamas/followers","following_url":"https://api.github.com/users/ntamas/following{/other_user}","gists_url":"https://api.github.com/users/ntamas/gists{/gist_id}","starred_url":"https://api.github.com/users/ntamas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntamas/subscriptions","organizations_url":"https://api.github.com/users/ntamas/orgs","repos_url":"https://api.github.com/users/ntamas/repos","events_url":"https://api.github.com/users/ntamas/events{/privacy}","received_events_url":"https://api.github.com/users/ntamas/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-01-14T21:56:36Z","updated_at":"2015-01-14T21:56:51Z","closed_at":null,"body":"_From @gaborcsardi on May 4, 2013 18:58_\n\nThe following code would generate a segmentation fault error when calling the \"project\" function for the second time, using Django (python) development server :\n\nfrom igraph import *\nfrom django.http import HttpResponse\n\ndef project(request):\n    print \"creating graph\"\n    g = Graph()\n    print \"reading graph\"\n    summary(g)\n    print \"returning response\"\n    return HttpResponse(\"Test\")\n\nThe segfault occurs when reading the graph under the same variable name (i.e. \"g\" here) on the second call. If the name of the variable is changed (e.g. from \"g\" to \"g1\") between the first and the second call, no segfault occurs (it may be artefact though since the script is reloaded) by the server.\n\nI am not familiar with segfault, Django dev server and C-alike problematics, but my feeling is that a memory segment is not freed when it should have been (if, of course, the goal is to emulate a production server process).\n\nNeither do I know if the problem lies within igraph of Django. But since both libraries seem quite used - and dev bug a thorn in the foot, it seems useful to set it up as soon as possible. \n\n***\nTested on Linux Mandriva 2011 (i686), Python 2.7.2, Django 1.4.3\nand Debian 6.0 (x86_64), Python 2.6.6, Django 1.4.1\nusing igraph-6.0 (and python_igraph-6.0) libraries both compiled from source.\n***\n\nPython mod_wsgi apache server is not affected, though. And the following bunch code works without any problem.\n\n#! /usr/bin/env python\nfrom wsgiref.simple_server import make_server\nfrom igraph import *\n\ndef application(environ, start_response):\n    graph = Graph()\n    summary(graph)\n    response_headers = [('Content-Type', 'text/plain'),\n                  ('Content-Length', str(0))]\n    start_response('200 OK', response_headers)\n\n    return [\"test\"]\n\nhttpd = make_server('localhost', 8051, application)\nhttpd.handle_request()\nhttpd.serve_forever()\n\n------------------------------------\nImported from Launchpad using lp2gh.\n\n * date created: 2013-01-17T08:24:16Z\n * owner: pierrevaillant\n * assignee: ntamas\n * the launchpad url was https://bugs.launchpad.net/bugs/1100662\n\n\n_Copied from original issue: igraph/igraph#251_"},"comment":{"url":"https://api.github.com/repos/igraph/python-igraph/issues/comments/70000203","html_url":"https://github.com/igraph/python-igraph/issues/4#issuecomment-70000203","issue_url":"https://api.github.com/repos/igraph/python-igraph/issues/4","id":70000203,"user":{"login":"gaborcsardi","id":660288,"avatar_url":"https://avatars.githubusercontent.com/u/660288?v=3","gravatar_id":"","url":"https://api.github.com/users/gaborcsardi","html_url":"https://github.com/gaborcsardi","followers_url":"https://api.github.com/users/gaborcsardi/followers","following_url":"https://api.github.com/users/gaborcsardi/following{/other_user}","gists_url":"https://api.github.com/users/gaborcsardi/gists{/gist_id}","starred_url":"https://api.github.com/users/gaborcsardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaborcsardi/subscriptions","organizations_url":"https://api.github.com/users/gaborcsardi/orgs","repos_url":"https://api.github.com/users/gaborcsardi/repos","events_url":"https://api.github.com/users/gaborcsardi/events{/privacy}","received_events_url":"https://api.github.com/users/gaborcsardi/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T21:56:51Z","updated_at":"2015-01-14T21:56:51Z","body":"(by ntamas)\nI find it a bit odd that gcc complains about an undefined reference to 'sqrt', but let's pretend for the time being that gcc is right. 'sqrt' is to be found in the math library, so try to add 'm' to the LIBIGRAPH_FALLBACK_LIBRARIES list in setup.py and then recompile."}}