robotframework / robotframework/robotframework

Using python multiprocessing lib and logger from robot.api corrupts output.xml' file.

Open
#5,193 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.9k
Forks
2.6k
Avg merge
1d 18h
Merged PRs (30d)
10

Description

Robot versions: 7.0.1
Python 3.11
Amazon Linux image used

I have tests where I'm using python multiprocessing library. When I'm running them on AWS linux machine I'm getting an error "output.xml' failed: Incompatible child element 'arg' for 'test'". But when I'm running them locally in my MacOS environment everything is ok.
This issue occurs upon using logger from robot framework api lib. When two different process are trying to log some data, output.xml file gets corrupted. When logger is removed from functions that are used multiprocessing library everything is working:
Example:

from multiprocessing import Process
from robot.api import logger  # to import robot logger lib

def some_func(arg1):
      logger.info('Some arg {arg1})

processes = []

for i in range(2):
    p = Process(target=some_func, args=(i))
    processes.append(p)

for p in processes:
    p.start()

for p in processes:
    p.join()

Amazon Linux image was used
Received error after test execution:
'output.xml' failed: Incompatible child element 'arg' for 'test'.

Screenshot 2024-08-30 at 13 52 43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the multiprocessing example using Python's multiprocessing library and robot.api.logger, then reproduce the failure on the stated Amazon Linux environment and compare it with macOS. Inspect how concurrent logger calls affect output.xml and its validation. Done means multiprocessing tests can log from separate processes without producing the “Incompatible child element 'arg'” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.