Closed GoogleCodeExporter closed 9 years ago
Original comment by flier...@gmail.com
on 11 Sep 2012 at 5:45
Can you point me where I should look into source code to try to fix this bug?
I’m not C++ programmer, but I really need to fix it :(
Original comment by serge....@gmail.com
on 20 Sep 2012 at 8:54
Sorry for the slow response, just back from vacation, I will check it at weekend
Original comment by flier...@gmail.com
on 20 Sep 2012 at 5:22
Great, thank you very much!
Original comment by serge....@gmail.com
on 20 Sep 2012 at 7:37
It seems you are trying free a v8 object in JS after the related pyv8 wrapper
object has been GC by Python.
I think you could try to leave a JS context with a forced v8 and python GC,
which could ensure the free sequence
JSEngine.collect()
gc.collect()
Original comment by flier...@gmail.com
on 21 Sep 2012 at 2:56
Didn’t work for me :(
Here’s how I try to reset context:
PyV8.JSEngine.collect()
gc.collect()
self._ctx.leave() # self._ctx is instance of JSContext
self._ctx = None
The first reset worked fine, but but second one crashes with the following
exception (EXC_BAD_ACCESS):
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.python.python 0x000000010be0db5e PyErr_Fetch + 14
1 org.python.python 0x000000010be0fb51 0x10bde3000 + 183121
2 _PyV8.so 0x0000000111d44afa
std::auto_ptr<boost::python::api::object>::reset(boost::python::api::object*) +
56 (memory:332)
3 _PyV8.so 0x0000000111d43f37
ObjectTracer::~ObjectTracer() + 105 (memory:258)
4 _PyV8.so 0x0000000111d44d1b
std::auto_ptr<ObjectTracer>::~auto_ptr() + 23 (memory:258)
5 _PyV8.so 0x0000000111d43fbb
ObjectTracer::WeakCallback(v8::Persistent<v8::Value>, void*) + 21
(Wrapper.cpp:1579)
6 _PyV8.so 0x0000000111e1bba8
v8::internal::GlobalHandles::Node::PostGarbageCollectionProcessing(v8::internal:
:Isolate*, v8::internal::GlobalHandles*) + 318
7 _PyV8.so 0x0000000111e1b5be
v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::Garba
geCollector) + 156
8 _PyV8.so 0x0000000111e3a6c2
v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector,
v8::internal::GCTracer*) + 1872
9 _PyV8.so 0x0000000111e3b974
v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace,
v8::internal::GarbageCollector, char const*, char const*) + 374
10 _PyV8.so 0x0000000111e3bf63
v8::internal::Heap::CollectAllGarbage(int, char const*) + 99
11 _PyV8.so 0x0000000111dfb1a6
v8::internal::Execution::HandleStackGuardInterrupt(v8::internal::Isolate*) + 150
12 ??? 0x00000fa83fd0618e 0 + 17215299543438
13 ??? 0x00000fa83ff0bb1c 0 + 17215301663516
14 ??? 0x00000fa83fd240e7 0 + 17215299666151
15 ??? 0x00000fa83fd11417 0 + 17215299589143
16 _PyV8.so 0x0000000111dfbf4c
v8::internal::Invoke(bool, v8::internal::Handle<v8::internal::JSFunction>,
v8::internal::Handle<v8::internal::Object>, int,
v8::internal::Handle<v8::internal::Object>*, bool*) + 444
17 _PyV8.so 0x0000000111f45568
v8::internal::Runtime_Apply(v8::internal::Arguments, v8::internal::Isolate*) +
472
18 ??? 0x00000fa83fd0618e 0 + 17215299543438
19 ??? 0x00000fa83fd3c756 0 + 17215299766102
20 ??? 0x00000fa83fd0a64e 0 + 17215299561038
21 ??? 0x00000fa83fdf59a8 0 + 17215300524456
22 ??? 0x00000fa83fdf858c 0 + 17215300535692
23 ??? 0x00000fa83fd0a64e 0 + 17215299561038
24 ??? 0x00000fa83ff08e3e 0 + 17215301652030
25 ??? 0x00000fa83fd3544d 0 + 17215299736653
26 ??? 0x00000fa83fd0a64e 0 + 17215299561038
27 ??? 0x00000fa83ff18d64 0 + 17215301717348
28 ??? 0x00000fa83fd7dd48 0 + 17215300033864
29 ??? 0x00000fa83fd0a64e 0 + 17215299561038
30 ??? 0x00000fa83fdfb658 0 + 17215300548184
31 ??? 0x00000fa83fda8ee9 0 + 17215300210409
32 ??? 0x00000fa83fd0a64e 0 + 17215299561038
33 ??? 0x00000fa83ff18dee 0 + 17215301717486
34 ??? 0x00000fa83fd7dd48 0 + 17215300033864
35 ??? 0x00000fa83fd0a64e 0 + 17215299561038
36 ??? 0x00000fa83fdfb658 0 + 17215300548184
37 ??? 0x00000fa83fda8ee9 0 + 17215300210409
38 ??? 0x00000fa83fd0a64e 0 + 17215299561038
39 ??? 0x00000fa83ff18dee 0 + 17215301717486
40 ??? 0x00000fa83fda9563 0 + 17215300212067
41 ??? 0x00000fa83fd0a64e 0 + 17215299561038
42 ??? 0x00000fa83fdfb658 0 + 17215300548184
43 ??? 0x00000fa83fda8ee9 0 + 17215300210409
44 ??? 0x00000fa83fd0a64e 0 + 17215299561038
45 ??? 0x00000fa83fda6ceb 0 + 17215300201707
46 ??? 0x00000fa83fda9563 0 + 17215300212067
47 ??? 0x00000fa83fd0a64e 0 + 17215299561038
48 ??? 0x00000fa83fdfb658 0 + 17215300548184
49 ??? 0x00000fa83fda8ee9 0 + 17215300210409
50 ??? 0x00000fa83fd0a64e 0 + 17215299561038
51 ??? 0x00000fa83fda6ceb 0 + 17215300201707
52 ??? 0x00000fa83fd8d4dd 0 + 17215300097245
53 ??? 0x00000fa83fd7d9cc 0 + 17215300032972
54 ??? 0x00000fa83fd2767e 0 + 17215299679870
55 ??? 0x00000fa83fd7c8fd 0 + 17215300028669
56 ??? 0x00000fa83fd0a64e 0 + 17215299561038
57 ??? 0x00000fa83fd7c7b5 0 + 17215300028341
58 ??? 0x00000fa83fd7c605 0 + 17215300027909
59 ??? 0x00000fa83fd7bf8b 0 + 17215300026251
60 ??? 0x00000fa83fd0a64e 0 + 17215299561038
61 ??? 0x00000fa83fd7bc9f 0 + 17215300025503
62 ??? 0x00000fa83fd0a64e 0 + 17215299561038
63 ??? 0x00000fa83fd7a35b 0 + 17215300019035
64 ??? 0x00000fa83fd7691f 0 + 17215300004127
65 ??? 0x00000fa83fd0a64e 0 + 17215299561038
66 ??? 0x00000fa83fd27678 0 + 17215299679864
67 ??? 0x00000fa83fd76437 0 + 17215300002871
68 ??? 0x00000fa83fd761eb 0 + 17215300002283
69 ??? 0x00000fa83fd240e7 0 + 17215299666151
70 ??? 0x00000fa83fd11417 0 + 17215299589143
71 _PyV8.so 0x0000000111dfbf4c
v8::internal::Invoke(bool, v8::internal::Handle<v8::internal::JSFunction>,
v8::internal::Handle<v8::internal::Object>, int,
v8::internal::Handle<v8::internal::Object>*, bool*) + 444
72 _PyV8.so 0x0000000111dad7e2
v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*) + 330
73 _PyV8.so 0x0000000111d43c68
CJavascriptFunction::Call(v8::Handle<v8::Object>, boost::python::list,
boost::python::dict) + 1456 (Wrapper.cpp:1410)
74 _PyV8.so 0x0000000111d3a632
CJavascriptFunction::CallWithArgs(boost::python::tuple, boost::python::dict) +
1102 (object_core.hpp:526)
75 _PyV8.so 0x0000000111d4707e
boost::python::detail::raw_dispatcher<boost::python::api::object
(*)(boost::python::tuple, boost::python::dict)>::operator()(_object*, _object*)
+ 56 (object_core.hpp:543)
76 libboost_python-mt.dylib 0x0000000112739363
boost::python::objects::function::call(_object*, _object*) const + 733
77 libboost_python-mt.dylib 0x0000000112737f10
boost::detail::function::void_function_ref_invoker0<boost::python::objects::(ano
nymous namespace)::bind_return,
void>::invoke(boost::detail::function::function_buffer&) + 32
78 libboost_python-mt.dylib 0x000000011274108c
boost::python::detail::exception_handler::operator()(boost::function0<void>
const&) const + 174
79 _PyV8.so 0x0000000111d17808 bool
boost::_bi::list3<boost::arg<1>, boost::arg<2>, boost::_bi::value<void
(*)(CJavascriptException const&)> >::operator()<bool,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>,
boost::_bi::list2<boost::python::detail::exception_handler const&,
boost::function0<void> const&> >(boost::_bi::type<bool>,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>&,
boost::_bi::list2<boost::python::detail::exception_handler const&,
boost::function0<void> const&>&, long) + 22 (bind.hpp:382)
80 _PyV8.so 0x0000000111d177eb
boost::detail::function::function_obj_invoker2<boost::_bi::bind_t<bool,
boost::python::detail::translate_exception<CJavascriptException, void
(*)(CJavascriptException const&)>, boost::_bi::list3<boost::arg<1>,
boost::arg<2>, boost::_bi::value<void (*)(CJavascriptException const&)> > >,
bool, boost::python::detail::exception_handler const&, boost::function0<void>
const&>::invoke(boost::detail::function::function_buffer&,
boost::python::detail::exception_handler const&, boost::function0<void> const&)
+ 35 (function_template.hpp:132)
81 libboost_python-mt.dylib 0x00000001127410f3
boost::python::handle_exception_impl(boost::function0<void>) + 99
82 libboost_python-mt.dylib 0x000000011273843f function_call + 79
83 org.python.python 0x000000010bdf6aba PyObject_Call + 97
84 org.python.python 0x000000010be1119a 0x10bde3000 + 188826
85 org.python.python 0x000000010bdf6aba PyObject_Call + 97
86 org.python.python 0x000000010be7adb3 0x10bde3000 + 622003
87 org.python.python 0x000000010bdf6aba PyObject_Call + 97
88 org.python.python 0x000000010bdfa225 PyEval_EvalFrameEx + 8032
89 org.python.python 0x000000010bdf8281 PyEval_EvalCodeEx + 1956
90 org.python.python 0x000000010bdfe661 0x10bde3000 + 112225
91 org.python.python 0x000000010bdfa0d2 PyEval_EvalFrameEx + 7693
92 org.python.python 0x000000010bdf8281 PyEval_EvalCodeEx + 1956
93 org.python.python 0x000000010bdfe661 0x10bde3000 + 112225
94 org.python.python 0x000000010bdfa0d2 PyEval_EvalFrameEx + 7693
95 org.python.python 0x000000010bdfe5eb 0x10bde3000 + 112107
96 org.python.python 0x000000010bdfa0d2 PyEval_EvalFrameEx + 7693
97 org.python.python 0x000000010bdf8281 PyEval_EvalCodeEx + 1956
98 org.python.python 0x000000010bdfe661 0x10bde3000 + 112225
99 org.python.python 0x000000010bdfa0d2 PyEval_EvalFrameEx + 7693
100 org.python.python 0x000000010bdfe5eb 0x10bde3000 + 112107
101 org.python.python 0x000000010bdfa0d2 PyEval_EvalFrameEx + 7693
102 org.python.python 0x000000010bdf8281 PyEval_EvalCodeEx + 1956
103 org.python.python 0x000000010be37f78 0x10bde3000 + 348024
104 org.python.python 0x000000010bdf6aba PyObject_Call + 97
105 org.python.python 0x000000010bdfddfc
PyEval_CallObjectWithKeywords + 177
106 org.python.python 0x000000010be2680a PyEval_CallFunction + 183
107 com.sublimetext.2 0x000000010b575d65
boost::python::detail::returnable<boost::python::api::object>::type
boost::python::call<boost::python::api::object, SP<TextBufferView>,
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>
>, int, boost::python::api::object, bool>(_object*, SP<TextBufferView> const&,
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
const&, int const&, boost::python::api::object const&, bool const&,
boost::type<boost::python::api::object>*) + 197
108 com.sublimetext.2 0x000000010b572545
plugin_loader::run_query_context_callback(char const*, SP<TextBufferView>,
context_match const*) + 303
109 com.sublimetext.2 0x000000010b583640
plugin_handler::on_query_context(context_match const*) + 56
110 com.sublimetext.2 0x000000010b5c0874
skyline_text_control::query_context(context_match const*) + 1314
111 com.sublimetext.2 0x000000010b4774b4
message_handler::handle_message(ui_message_type, void*) + 76
112 com.sublimetext.2 0x000000010b458547
route_message_using_input_focus(ui_message_type, void*, control*) + 151
113 com.sublimetext.2 0x000000010b4a80a8 0x10b434000 + 475304
114 com.sublimetext.2 0x000000010b46ca8a
binding_map::match_events(std::vector<input_event, std::allocator<input_event>
> const&, bool (*)(context_match const&, void*), void*, bool*, int*, char
const**, bool*) const + 250
115 com.sublimetext.2 0x000000010b46d229
input_automata::push(input_event const&, std::vector<match_result,
std::allocator<match_result> >*) + 885
116 com.sublimetext.2 0x000000010b46d366
input_automata::push(px_key_event_t const&, std::vector<match_result,
std::allocator<match_result> >*) + 48
117 com.sublimetext.2 0x000000010b4a9996
window_impl::handle_event(px_event_t*) + 4754
118 com.sublimetext.2 0x000000010b691f18 0x10b434000 + 2481944
119 com.apple.AppKit 0x00007fff912ff744 -[NSApplication
sendEvent:] + 5761
120 com.apple.AppKit 0x00007fff912152fa -[NSApplication run] + 636
121 com.sublimetext.2 0x000000010b5273cb main + 2251
122 com.sublimetext.2 0x000000010b436064 start + 52
Original comment by serge....@gmail.com
on 21 Sep 2012 at 3:20
First, please force GC after leave the context, because the context will hold
the local objects
self._ctx.leave() # self._ctx is instance of JSContext
self._ctx = None
PyV8.JSEngine.collect()
gc.collect()
Second, please ensure you doesn't use any object that's belong to a JS context
which has been freed
Original comment by flier...@gmail.com
on 22 Sep 2012 at 1:52
Looks good now, had no crashes during my tests. Thank you very much!
Original comment by serge....@gmail.com
on 23 Sep 2012 at 8:40
great!
Original comment by flier...@gmail.com
on 24 Sep 2012 at 9:15
Original issue reported on code.google.com by
serge....@gmail.com
on 10 Sep 2012 at 2:42