Open GoogleCodeExporter opened 8 years ago
Slightly different trace from another run:
Core was generated by `/usr/sbin/openvpn --daemon --writepid
/var/run/openvpn/vpn-tcp.pid --config vpn'.
Program terminated with signal 6, Aborted.
#0 0x00e8c402 in __kernel_vsyscall ()
(gdb) where
#0 0x00e8c402 in __kernel_vsyscall ()
#1 0x00b8edf0 in raise () from /lib/libc.so.6
#2 0x00b90701 in abort () from /lib/libc.so.6
#3 0x00b8826b in __assert_fail () from /lib/libc.so.6
#4 0x00652f8d in visit_decref (op=0xb7cf2bdc, data=0x0) at
Modules/gcmodule.c:277
#5 0x005b8c7c in frame_traverse (f=0xa19b02c, visit=0x652ee0 <visit_decref>,
arg=0x0) at Objects/frameobject.c:461
#6 0x006535d8 in subtract_refs (generation=2) at Modules/gcmodule.c:296
#7 collect (generation=2) at Modules/gcmodule.c:817
#8 0x00653fa8 in collect_generations (basicsize=20) at Modules/gcmodule.c:924
#9 _PyObject_GC_Malloc (basicsize=20) at Modules/gcmodule.c:1363
#10 0x00654035 in _PyObject_GC_New (tp=0x6bda60) at Modules/gcmodule.c:1373
#11 0x005c1e75 in PyList_New (size=0) at Objects/listobject.c:142
#12 0x006260bd in PyEval_EvalFrameEx (f=0xa24f364, throwflag=0) at
Python/ceval.c:2050
#13 0x00629aea in call_function (f=0xa24ea4c, throwflag=0) at
Python/ceval.c:3836
#14 PyEval_EvalFrameEx (f=0xa24ea4c, throwflag=0) at Python/ceval.c:2412
#15 0x0062a3f1 in PyEval_EvalCodeEx (co=0x9ed5800, globals=0x9ed0714,
locals=0x0, args=0x9f5bcc8, argcount=5, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:3000
#16 0x005bafba in function_call (func=0x9ee048c, arg=0x9f5bcbc, kw=0x0) at
Objects/funcobject.c:524
#17 0x0058f58c in PyObject_Call (func=0x9ee048c, arg=0x9f5bcbc, kw=0x0) at
Objects/abstract.c:2492
#18 0x00624adf in ext_do_call (f=0xa24e75c, throwflag=0) at Python/ceval.c:4063
#19 PyEval_EvalFrameEx (f=0xa24e75c, throwflag=0) at Python/ceval.c:2452
#20 0x00629aea in call_function (f=0xa1a75dc, throwflag=0) at
Python/ceval.c:3836
#21 PyEval_EvalFrameEx (f=0xa1a75dc, throwflag=0) at Python/ceval.c:2412
#22 0x0062a3f1 in PyEval_EvalCodeEx (co=0x9ed5848, globals=0x9ded1c4,
locals=0x0, args=0xa1a5b8c, argcount=1, kws=0xa1a5b90, kwcount=0,
defs=0x9f48ef8, defcount=1, closure=0x0) at Python/ceval.c:3000
#23 0x00628338 in call_function (f=0xa1a59fc, throwflag=0) at
Python/ceval.c:3846
#24 PyEval_EvalFrameEx (f=0xa1a59fc, throwflag=0) at Python/ceval.c:2412
#25 0x0062a3f1 in PyEval_EvalCodeEx (co=0x9f4e0f8, globals=0x9f4a68c,
locals=0x0, args=0xa105180, argcount=15, kws=0xa1051bc, kwcount=0,
defs=0x9f4e3e0, defcount=12, closure=0x0) at Python/ceval.c:3000
#26 0x00628338 in call_function (f=0xa10500c, throwflag=0) at
Python/ceval.c:3846
#27 PyEval_EvalFrameEx (f=0xa10500c, throwflag=0) at Python/ceval.c:2412
#28 0x0062a3f1 in PyEval_EvalCodeEx (co=0x9ed59f8, globals=0x9f4a2d4,
locals=0x0, args=0x9f48498, argcount=2, kws=0xaab33b0, kwcount=1,
defs=0x9edfce0, defcount=12, closure=0x0) at Python/ceval.c:3000
#29 0x005bb0a9 in function_call (func=0x9f46f0c, arg=0x9f4848c, kw=0xa29ddfc)
at Objects/funcobject.c:524
#30 0x0058f58c in PyObject_Call (func=0x9f46f0c, arg=0x9f4848c, kw=0xa29ddfc)
at Objects/abstract.c:2492
#31 0x00624adf in ext_do_call (f=0xa199ac4, throwflag=0) at Python/ceval.c:4063
#32 PyEval_EvalFrameEx (f=0xa199ac4, throwflag=0) at Python/ceval.c:2452
#33 0x0062a3f1 in PyEval_EvalCodeEx (co=0x9ee9650, globals=0x9f4a2d4,
locals=0x0, args=0xa19b198, argcount=1, kws=0xa19b19c, kwcount=1,
defs=0x9ed1f58, defcount=1, closure=0x0) at Python/ceval.c:3000
#34 0x00628338 in call_function (f=0xa19b02c, throwflag=0) at
Python/ceval.c:3846
#35 PyEval_EvalFrameEx (f=0xa19b02c, throwflag=0) at Python/ceval.c:2412
#36 0x0062a3f1 in PyEval_EvalCodeEx (co=0xb7f54650, globals=0xb7cf2bdc,
locals=0x0, args=0xb7cef858, argcount=1, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:3000
#37 0x005bafba in function_call (func=0x9f661b4, arg=0xb7cef84c, kw=0x0) at
Objects/funcobject.c:524
#38 0x0058f58c in PyObject_Call (func=0x9f661b4, arg=0xb7cef84c, kw=0x0) at
Objects/abstract.c:2492
#39 0x00622f74 in PyEval_CallObjectWithKeywords (func=0x9f661b4,
arg=0xb7cef84c, kw=0x0) at Python/ceval.c:3619
#40 0x0058ffcc in PyObject_CallObject (o=0x9f661b4, a=0xb7cef84c) at
Objects/abstract.c:2480
#41 0x00940e1f in openvpn_plugin_func_v1 (handle=0x9d01970, type=9,
argv=0xa6c10b0, envp=0xa183fd0) at ovpn-py.c:183
#42 0x0808c4b4 in plugin_call ()
#43 0x08071e22 in multi_process_post ()
#44 0x08073893 in multi_process_incoming_link ()
#45 0x0806d195 in multi_tcp_action ()
#46 0x0806db69 in tunnel_server_tcp ()
#47 0x08077430 in main ()
Original comment by itk...@gmail.com
on 28 Nov 2011 at 2:53
Python plugin implements plugin_up, plugin_down, auth_user_pass_verify,
client_connect and client_disconnect.
Original comment by itk...@gmail.com
on 28 Nov 2011 at 2:56
Note lines
http://code.google.com/p/ovpn-py/source/browse/ovpn-py.c#158
and
http://code.google.com/p/ovpn-py/source/browse/ovpn-py.c#202
According to http://docs.python.org/c-api/intro.html#reference-count-details,
"Few functions steal references; the two notable exceptions are
PyList_SetItem() and PyTuple_SetItem(), which steal a reference to the item
(but not to the tuple or list into which the item is put!)."
env being added to tuple doesn't need Py_DECREF.
Another error is at
http://code.google.com/p/ovpn-py/source/browse/ovpn-py.c#155
Unlike PyTuple_SetItem, PyDict_SetItemString does not steal reference, so
caller is responsible for calling Py_DECREF.
Finally (and this is what appears to cause the crashes), there's a Py_DECREF at
http://code.google.com/p/ovpn-py/source/browse/ovpn-py.c#134 on a borrowed
references (returned by PyModule_GetDict at
http://code.google.com/p/ovpn-py/source/browse/ovpn-py.c#77).
Attached patch fixes all these issues. With this patch applied I have openvpn
running for almost three days now without crashes, although memory usage
seems to have climbed a bit too high, so there still may be memory leaks.
Original comment by itk...@gmail.com
on 4 Dec 2011 at 4:08
Attachments:
Original issue reported on code.google.com by
itk...@gmail.com
on 24 Nov 2011 at 4:08