After Update to RF 4.1.2 startied getting "FAIL - RecursionError: maximum recursion depth exceeded"

After Updating robot test suite to RF 4.1.2 started getting “FAIL - RecursionError: maximum recursion depth exceeded”
this crashes robot .

I understand increasing the limit of recursion is one of the suggested solution.
Is there a way to find which keywords calling is causing maximum recursion count.
Given problematic keyword is found I can optimise it to use iteration instead of recursion

 File "/usr/local/lib/python3.6/site-packages/robot/libraries/BuiltIn.py", line 1870, in run_keyword
    return kw.run(self._context)
  File "/usr/local/lib/python3.6/site-packages/robot/running/model.py", line 78, in run
    return KeywordRunner(context, run).run(self)
  File "/usr/local/lib/python3.6/site-packages/robot/running/bodyrunner.py", line 65, in run
    return runner.run(step, context, self._run)
  File "/usr/local/lib/python3.6/site-packages/robot/running/librarykeywordrunner.py", line 51, in run
    with StatusReporter(kw, result, context, run):
  File "/usr/local/lib/python3.6/site-packages/robot/running/statusreporter.py", line 41, in __enter__
    context.start_keyword(ModelCombiner(self.data, result))
  File "/usr/local/lib/python3.6/site-packages/robot/running/context.py", line 187, in start_keyword
    self.output.start_keyword(keyword)
  File "/usr/local/lib/python3.6/site-packages/robot/output/output.py", line 63, in start_keyword
    LOGGER.start_keyword(kw)
  File "/usr/local/lib/python3.6/site-packages/robot/output/logger.py", line 221, in start_keyword
    logger.start_keyword(keyword)
  File "/usr/local/lib/python3.6/site-packages/robot/output/logger.py", line 272, in start_keyword
    method(kw)
  File "/usr/local/lib/python3.6/site-packages/robot/output/logger.py", line 272, in start_keyword
    method(kw)
  File "/usr/local/lib/python3.6/site-packages/robot/output/logger.py", line 272, in start_keyword
    method(kw)
  [Previous line repeated 909 more times]
  File "/usr/local/lib/python3.6/site-packages/robot/output/xmllogger.py", line 74, in start_keyword
    self._write_list('arg', [unic(a) for a in kw.args])
  File "/usr/local/lib/python3.6/site-packages/robot/output/xmllogger.py", line 182, in _write_list
    self._writer.element(tag, item)
  File "/usr/local/lib/python3.6/site-packages/robot/utils/markupwriters.py", line 103, in element
    _MarkupWriter.element(self, name, content, attrs, escape, newline)
  File "/usr/local/lib/python3.6/site-packages/robot/utils/markupwriters.py", line 71, in element
    self.content(content, escape)
  File "/usr/local/lib/python3.6/site-packages/robot/utils/markupwriters.py", line 59, in content
    self._write(self._escape(content) if escape else content, newline)
  File "/usr/local/lib/python3.6/site-packages/robot/utils/markupwriters.py", line 99, in _escape
    return xml_escape(text)
  File "/usr/local/lib/python3.6/site-packages/robot/utils/markuputils.py", line 37, in xml_escape
    return _illegal_chars_in_xml.sub('', _escape(text))

It can not changed from outside, it is hard coded somewhere in the Robot Framework code. The better way would be to remove the recursion.

Removal of recursion seems to be needed in logger.py library in [11:37] Vikramjeet Singh
def start_keyword(self, keyword):

TODO: Could _prev_log_message_handlers be used also here?

self._started_keywords += 1
self.log_message = self._log_message
for logger in self.start_loggers:
logger.start_keyword(keyword) def end_keyword(self, keyword):
self._started_keywords -= 1
for logger in self.end_loggers:
logger.end_keyword(keyword)
if not self._started_keywords:
self.log_message = self.message

Is there a chance that as our code is still using "Run Keyword If " a lot and not yet migrating to IF/ELSE IF/ELSE cause of the issue ?

It’s strange that only updating RF caused this. What version did you use earlier? Is it possible for you to create a simple example demonstrating the problem? If it is, please submit an issue and include the example into it.

Only change done in code is updating the RF from version 3.2.2 to 4.1.2.
While I am still looking into what’s causing the issue another similar crash error when executing different set of tests:

Could test how RF 4.0 works?

Okay…will try rf4.0.