{"action":"created","issue":{"url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/27","labels_url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/27/comments","events_url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/27/events","html_url":"https://github.com/CRPropa/CRPropa3/issues/27","id":84627244,"number":27,"title":"Extending of CRPropa modules in Python shell leads to segfault","user":{"login":"adundovi","id":8830248,"avatar_url":"https://avatars.githubusercontent.com/u/8830248?v=3","gravatar_id":"","url":"https://api.github.com/users/adundovi","html_url":"https://github.com/adundovi","followers_url":"https://api.github.com/users/adundovi/followers","following_url":"https://api.github.com/users/adundovi/following{/other_user}","gists_url":"https://api.github.com/users/adundovi/gists{/gist_id}","starred_url":"https://api.github.com/users/adundovi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adundovi/subscriptions","organizations_url":"https://api.github.com/users/adundovi/orgs","repos_url":"https://api.github.com/users/adundovi/repos","events_url":"https://api.github.com/users/adundovi/events{/privacy}","received_events_url":"https://api.github.com/users/adundovi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-03T15:40:18Z","updated_at":"2015-08-01T20:22:04Z","closed_at":null,"body":"Examples of extending CRPropa given [here](https://github.com/CRPropa/CRPropa3/wiki/Extending%20CRPropa) are leading to segmentation faults when used in Python interactive shell.\r\n\r\nSteps to reproduce:\r\n1. run python shell (tried python 2.7.9 and 2.6.6)\r\n2. import crpropa: `from crpropa import *`\r\n3. paste an example to shell:\r\n```python\r\nclass MyModule(Module):\r\n    \"\"\" Reduces the cosmic ray energy by 10% in each step \"\"\"\r\n    def process(self, c):\r\n        c.current.setEnergy(c.current.getEnergy() * 0.9)\r\n\r\nm = ModuleList()\r\nm.add(MyModule())\r\n\r\nc = Candidate()\r\nc.current.setEnergy(10)\r\nm.process(c)\r\n```\r\n4. segmentation fault, trace:\r\n```\r\n *** Break *** segmentation violation\r\n\r\n===========================================================\r\nThere was a crash.\r\nThis is the entire stack trace of all threads:\r\n===========================================================\r\n#0  0x0000003b320c7eea in waitpid () from /lib64/libc.so.6\r\n#1  0x0000003b32043a4b in do_system () from /lib64/libc.so.6\r\n#2  0x0000003b3446dff2 in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.5.34\r\n#3  0x0000003b3447025c in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.5.34\r\n#4  <signal handler called>\r\n#5  0x0000003b3208a9da in strlen () from /lib64/libc.so.6\r\n#6  0x0000003b3e491f7f in PyString_FromFormatV () from /lib64/libpython2.7.so.1.0\r\n#7  0x0000003b3e4ec01c in PyErr_Format () from /lib64/libpython2.7.so.1.0\r\n#8  0x0000003b3e4862e5 in PyObject_GetAttr () from /lib64/libpython2.7.so.1.0\r\n#9  0x0000003b3e486534 in PyObject_GetAttrString () from /lib64/libpython2.7.so.1.0\r\n#10 0x0000003b3e44aead in PyObject_CallMethod () from /lib64/libpython2.7.so.1.0\r\n#11 0x00007f49655a96a3 in SwigDirector_Module::process (this=0x1d5f660, candidate=0x1d90da0) at /home/a/crpropa_virtenv/crpropa3_build/build/crpropa_wrap.cxx:6968\r\n#12 0x00007f4964f0553b in crpropa::ModuleList::process (this=0x1a258b0, candidate=0x1d90da0) at /home/a/crpropa_virtenv/crpropa3_build/src/ModuleList.cpp:47\r\n#13 0x00007f496566d5ad in _wrap_ModuleList_process (self=0x7f496c31a1f0, args=0x7f496c312610) at /home/a/crpropa_virtenv/crpropa3_build/build/crpropa_wrap.cxx:62139\r\n#14 0x0000003b3e4e290e in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0\r\n#15 0x0000003b3e4e3704 in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0\r\n#16 0x0000003b3e4e3829 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0\r\n#17 0x0000003b3e4fcb5f in run_mod () from /lib64/libpython2.7.so.1.0\r\n#18 0x0000003b3e4febba in PyRun_InteractiveOneFlags () from /lib64/libpython2.7.so.1.0\r\n#19 0x0000003b3e4fed9e in PyRun_InteractiveLoopFlags () from /lib64/libpython2.7.so.1.0\r\n#20 0x0000003b3e4ff42e in PyRun_AnyFileExFlags () from /lib64/libpython2.7.so.1.0\r\n#21 0x0000003b3e511141 in Py_Main () from /lib64/libpython2.7.so.1.0\r\n#22 0x0000003b32020790 in __libc_start_main () from /lib64/libc.so.6\r\n#23 0x0000000000400729 in _start ()\r\n===========================================================\r\n\r\nThe lines below might hint at the cause of the crash.\r\nIf they do not help you then please submit a bug report at\r\nhttp://root.cern.ch/bugs. Please post the ENTIRE stack trace\r\nfrom above as an attachment in addition to anything else\r\nthat might help us fixing this issue.\r\n===========================================================\r\n#5  0x0000003b3208a9da in strlen () from /lib64/libc.so.6\r\n#6  0x0000003b3e491f7f in PyString_FromFormatV () from /lib64/libpython2.7.so.1.0\r\n#7  0x0000003b3e4ec01c in PyErr_Format () from /lib64/libpython2.7.so.1.0\r\n#8  0x0000003b3e4862e5 in PyObject_GetAttr () from /lib64/libpython2.7.so.1.0\r\n#9  0x0000003b3e486534 in PyObject_GetAttrString () from /lib64/libpython2.7.so.1.0\r\n#10 0x0000003b3e44aead in PyObject_CallMethod () from /lib64/libpython2.7.so.1.0\r\n#11 0x00007f49655a96a3 in SwigDirector_Module::process (this=0x1d5f660, candidate=0x1d90da0) at /home/a/crpropa_virtenv/crpropa3_build/build/crpropa_wrap.cxx:6968\r\n#12 0x00007f4964f0553b in crpropa::ModuleList::process (this=0x1a258b0, candidate=0x1d90da0) at /home/a/crpropa_virtenv/crpropa3_build/src/ModuleList.cpp:47\r\n#13 0x00007f496566d5ad in _wrap_ModuleList_process (self=0x7f496c31a1f0, args=0x7f496c312610) at /home/a/crpropa_virtenv/crpropa3_build/build/crpropa_wrap.cxx:62139\r\n#14 0x0000003b3e4e290e in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0\r\n#15 0x0000003b3e4e3704 in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0\r\n#16 0x0000003b3e4e3829 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0\r\n#17 0x0000003b3e4fcb5f in run_mod () from /lib64/libpython2.7.so.1.0\r\n#18 0x0000003b3e4febba in PyRun_InteractiveOneFlags () from /lib64/libpython2.7.so.1.0\r\n#19 0x0000003b3e4fed9e in PyRun_InteractiveLoopFlags () from /lib64/libpython2.7.so.1.0\r\n#20 0x0000003b3e4ff42e in PyRun_AnyFileExFlags () from /lib64/libpython2.7.so.1.0\r\n#21 0x0000003b3e511141 in Py_Main () from /lib64/libpython2.7.so.1.0\r\n#22 0x0000003b32020790 in __libc_start_main () from /lib64/libc.so.6\r\n#23 0x0000000000400729 in _start ()\r\n===========================================================\r\n\r\nSegmentation fault (core dumped)\r\n```\r\n\r\nIt seems that every call to a method which is doing something with object crafted in Python leads to segfault: .process(), getCandidate() and so on."},"comment":{"url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/comments/126949957","html_url":"https://github.com/CRPropa/CRPropa3/issues/27#issuecomment-126949957","issue_url":"https://api.github.com/repos/CRPropa/CRPropa3/issues/27","id":126949957,"user":{"login":"DavidWalz","id":2913236,"avatar_url":"https://avatars.githubusercontent.com/u/2913236?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidWalz","html_url":"https://github.com/DavidWalz","followers_url":"https://api.github.com/users/DavidWalz/followers","following_url":"https://api.github.com/users/DavidWalz/following{/other_user}","gists_url":"https://api.github.com/users/DavidWalz/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidWalz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidWalz/subscriptions","organizations_url":"https://api.github.com/users/DavidWalz/orgs","repos_url":"https://api.github.com/users/DavidWalz/repos","events_url":"https://api.github.com/users/DavidWalz/events{/privacy}","received_events_url":"https://api.github.com/users/DavidWalz/received_events","type":"User","site_admin":false},"created_at":"2015-08-01T20:22:04Z","updated_at":"2015-08-01T20:22:04Z","body":"The [galactic trajectory example notebook](http://nbviewer.ipython.org/github/CRPropa/CRPropa3-notebooks/blob/master/galactic_trajectories/galactic_trajectories.ipynb) seg-faults, even with disown."}}