`gi-docgen generate` randomly outputs corrupted text. Seen on Homebrew Linux CI (Ubuntu 16.04)
Seen when creating gi-docgen
formula for Homebrew: https://github.com/Homebrew/homebrew-core/pull/97898
Issue occurred on Homebrew Linux runner (Ubuntu 16.04 docker container). Package built using Python 3.10 in virtualenv with latest versions of Python dependencies.
The issue is a sporadic failure when running gi-docgen generate -C brew.toml brew.gir
where sometimes the command would print out corrupted/non-UTF8 characters and sometimes the generated files would contain corrupted/non-UTF8 characters.
e.g.
- in one instance, the following was seen at end of command:
INFO: Copying file /home/linuxbrew/.linuxbrew/Cellar/gi-docgen/2022.1/libexec/lib/python3.10/site-packages/gidocgen/templates/basic/SourceCodePro-Semibold.ttf.woff: /tmp/gi-docgen-test-20220328-94616-tpmk3j/brew-1.0/SourceCodePro-Semibold.ttf.woff �\@Y7�iP�pm�@p*fK@j_���g�T�m�@@R]@��R羑���m�@@R]@�쇹r�0n�@���@6g5� ��p3�@��@
- in another instance, the following was seen at end of generated file:
</html>j�6@����@8@@�T@@�41@@0�5@@�QK@(@�T@@p~�@
Currently, I am thinking issue is due to multithreading where different threads print
to stdout simultaneously (via log.info
/etc). After disabling stdout via --quiet
, I have not yet seen the issue over about 100 back-to-back attempts.
This is probably due to fact that Python's print
is not thread-safe.