opencog / ros-behavior-scripting

Hanson Robotics Eva robot sensory and motor API
GNU Affero General Public License v3.0
19 stars 29 forks source link

Fail to run `psi-step` manually #155

Closed leungmanhin closed 7 years ago

leungmanhin commented 7 years ago

After starting the whole stack, telnet to cogserver and then execute (psi-step) (or if the psi-loop has been started, run (psi-halt) followed by (psi-step)), it will crash:

terminate called after throwing an instance of 'opencog::AssertionException'
  what():   (/home/manhin/hansonrobotics/opencog/atomspace/opencog/guile/SchemeEval.cc:686)
/home/manhin/hansonrobotics/private_ws/scripts/btree.sh: line 20: 32601 Aborted                 (core dumped) $cmd

and found these in the log:

[2017-02-06 09:11:14:938] [INFO] [OpenPsi] Taking one psi-step, loop-count = 251
[2017-02-06 09:11:14:948] [ERROR] Python error in ros_is_running: maximum recursion depth exceeded while calling a Python object. (/home/manhin/hansonrobotics/opencog/atomspace/opencog/cython/PythonEval.cc:824)
    Stack Trace:
    2: basic_string.h:293     std::string::_M_data() const
    3: Logger.cc:493      opencog::Logger::Error::operator()(char const*, ...)
    4: exceptions.cc:55   opencog::StandardException::parse_error_message(char const*, __va_list_tag*, bool)
    5: exceptions.cc:81   opencog::StandardException::parse_error_message(char const*, char const*, __va_list_tag*, bool)
    6: exceptions.cc:150      opencog::RuntimeException::RuntimeException(char const*, char const*, ...)
    7: PythonEval.cc:824      opencog::PythonEval::call_user_function(std::string const&, opencog::Handle)
    8: shared_ptr_base.h:545    __base_dtor ()
    9: basic_string.h:539     std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
    10: shared_ptr_base.h:545   __base_dtor ()
    11: EvaluationLink.cc:453     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    12: EvaluationLink.cc:283     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    13: shared_ptr_base.h:545   __base_dtor ()
    14: EvaluationLink.cc:483     opencog::EvaluationLink::do_evaluate(opencog::AtomSpace*, opencog::Handle const&, bool)
    15: ExecSCM.cc:42   _ZL11ss_evaluatePN7opencog9AtomSpaceERKNS_6HandleE.84716()
    16: SchemeModule.cc:55    opencog::FunctionWrap::as_wrapper_p_h(opencog::Handle)
    17: shared_ptr_base.h:545   __base_dtor ()
    18: SchemePrimitive.cc:162    opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*)
    19: ??:0    scm_vm_engine()
    20: ??:0    scm_call_1()
    21: ??:0    scm_filter()
    22: ??:0    scm_vm_engine()
    23: ??:0    scm_call_1()
    24: ??:0    scm_vm_engine()
    25: ??:0    scm_call_3()
    26: ??:0    scm_vm_engine()
    27: ??:0    scm_call_4()
    28: SchemeEval.cc:565     opencog::SchemeEval::do_eval(std::string const&)
    29: SchemeEval.h:168    eval()
    30: basic_string.h:583    std::string::operator=(std::string&&)
    31: ??:0    PyEval_EvalFrameEx()
    32: ??:0    PyEval_EvalFrameEx()
    33: ??:0    PyEval_EvalFrameEx()
    34: ??:0    PyEval_EvalCodeEx()
    35: ??:0    initcPickle()
    36: ??:0    PyObject_Call()
    37: ??:0    PyEval_CallObjectWithKeywords()
    38: PythonEval.cc:815     opencog::PythonEval::call_user_function(std::string const&, opencog::Handle)
    39: shared_ptr_base.h:545   __base_dtor ()
    40: basic_string.h:539    std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
    41: shared_ptr_base.h:545   __base_dtor ()
    42: EvaluationLink.cc:483     opencog::EvaluationLink::do_evaluate(opencog::AtomSpace*, opencog::Handle const&, bool)
    43: shared_ptr_base.h:545   __base_dtor ()
    44: Instantiator.cc:475   opencog::Instantiator::instantiate(opencog::Handle const&, std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&)
    45: stl_tree.h:671  __base_dtor ()
    46: EvaluationLink.cc:403     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    47: EvaluationLink.cc:314     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    48: EvaluationLink.cc:453     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    49: EvaluationLink.cc:483     opencog::EvaluationLink::do_evaluate(opencog::AtomSpace*, opencog::Handle const&, bool)

[2017-02-06 09:11:15:180] [ERROR] Scheme: Failed to execute 'psi-prefix-str'
Backtrace:
In srfi/srfi-1.scm:
 578: 19 [map #<procedure 224a280 at opencog/openpsi/main.scm:127:8 (d)> (# # # ...)]
In ice-9/threads.scm:
  97: 18 [loop ((#))]
In opencog/openpsi/main.scm:
 104: 17 [act-and-evaluate #]
In unknown file:
   ?: 16 [opencog-extension cog-evaluate! ((DefinedPredicateNode "update-web-ui")
)]
In ice-9/boot-9.scm:
 157: 15 [catch #t #<catch-closure 2001820> ...]
In unknown file:
   ?: 14 [apply-smob/1 #<catch-closure 2001820>]
   ?: 13 [call-with-input-string "(psi-step)\npsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strpsi-prefix-strps
    Stack Trace:
    2: basic_string.h:293     std::string::_M_data() const
    3: Logger.cc:493      opencog::Logger::Error::operator()(char const*, ...)
    4: exceptions.cc:55   opencog::StandardException::parse_error_message(char const*, __va_list_tag*, bool)
    5: exceptions.cc:81   opencog::StandardException::parse_error_message(char const*, char const*, __va_list_tag*, bool)
    6: exceptions.cc:150      opencog::RuntimeException::RuntimeException(char const*, char const*, ...)
    7: PyScheme.cc:43     opencog::eval_scheme(opencog::AtomSpace&, std::string const&)
    8: basic_string.h:583     std::string::operator=(std::string&&)
    9: ??:0 PyEval_EvalFrameEx()
    10: ??:0    PyEval_EvalFrameEx()
    11: ??:0    PyEval_EvalFrameEx()
    12: ??:0    PyEval_EvalCodeEx()
    13: ??:0    initcPickle()
    14: ??:0    PyObject_Call()
    15: ??:0    PyEval_CallObjectWithKeywords()
    16: PythonEval.cc:815     opencog::PythonEval::call_user_function(std::string const&, opencog::Handle)
    17: shared_ptr_base.h:545   __base_dtor ()
    18: basic_string.h:539    std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
    19: shared_ptr_base.h:545   __base_dtor ()
    20: EvaluationLink.cc:483     opencog::EvaluationLink::do_evaluate(opencog::AtomSpace*, opencog::Handle const&, bool)
    21: shared_ptr_base.h:545   __base_dtor ()
    22: Instantiator.cc:475   opencog::Instantiator::instantiate(opencog::Handle const&, std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&)
    23: stl_tree.h:671  __base_dtor ()
    24: EvaluationLink.cc:403     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    25: EvaluationLink.cc:314     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    26: EvaluationLink.cc:453     opencog::EvaluationLink::do_eval_scratch(opencog::AtomSpace*, opencog::Handle const&, opencog::AtomSpace*, bool)
    27: EvaluationLink.cc:483     opencog::EvaluationLink::do_evaluate(opencog::AtomSpace*, opencog::Handle const&, bool)
    28: ExecSCM.cc:42   _ZL11ss_evaluatePN7opencog9AtomSpaceERKNS_6HandleE.84716()
    29: SchemeModule.cc:55    opencog::FunctionWrap::as_wrapper_p_h(opencog::Handle)
    30: shared_ptr_base.h:545   __base_dtor ()
    31: SchemePrimitive.cc:162    opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*)
    32: ??:0    scm_vm_engine()
    33: ??:0    scm_call_1()
    34: ??:0    scm_vm_engine()
    35: ??:0    scm_call_3()
    36: ??:0    scm_vm_engine()
    37: ??:0    scm_call_4()
    38: SchemeEval.cc:565     opencog::SchemeEval::do_eval(std::string const&)
    39: SchemeEval.h:168    eval()
    40: basic_string.h:583    std::string::operator=(std::string&&)
    41: ??:0    PyEval_EvalFrameEx()
    42: ??:0    PyEval_EvalFrameEx()
    43: ??:0    PyEval_EvalFrameEx()
    44: ??:0    PyEval_EvalCodeEx()
    45: ??:0    initcPickle()
    46: ??:0    PyObject_Call()
    47: ??:0    PyEval_CallObjectWithKeywords()
    48: PythonEval.cc:815     opencog::PythonEval::call_user_function(std::string const&, opencog::Handle)
    49: shared_ptr_base.h:545   __base_dtor ()

Interestingly, (psi-run) (which executes (psi-step) under the hood) works just fine...

leungmanhin commented 7 years ago

It doesn't crash if I run (psi-step) in the same tmux window that the cogserver is running

leungmanhin commented 7 years ago

Changes made in https://github.com/opencog/ros-behavior-scripting/pull/157 also affect this issue. Now it doesn't actually crash on my computer when I manually run (psi-step) in a telnet session right after the full stack has just started (i.e. before clicking the OC ON button). But still it's not fixed as the first (psi-step) I made always send loads of "psi-prefix-str" requests (as well as some other requests like "look at" / "gaze at" etc depending on the contexts) to the cogserver for some reason... as if it has gone through hundreds of psi-steps in a single (psi-step) function call, which is certainly not the right behavior

leungmanhin commented 7 years ago

This problem disappeared after applying https://github.com/opencog/ros-behavior-scripting/pull/158. I was suspecting that the original saliency tracking rule was somehow confusing the action selector or (DefinedPredicate "update-web-ui"), but I'm not 100% sure how. Anyway I will report again if I see this problem again