Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix decoding error when reading server log file #422

Merged
merged 1 commit into from Feb 13, 2024

Conversation

ylobankov
Copy link
Member

@ylobankov ylobankov commented Feb 12, 2024

When a diff test starts a Tarantool server, test-run reads the server log file and tries to find the message indicating the server is ready. Sometimes the server log file may contain bytes that cannot be decoded by utf-8 codec and test-run fails with an error like this:

[044] TarantoolInpector.handle() received the following error:
[044] Traceback (most recent call last):
[044]   File "/tarantool/test-run/lib/inspector.py", line 98, in handle
[044]     result = self.parser.parse_preprocessor(line)
[044]   File "/tarantool/test-run/lib/preprocessor.py", line 123, in parse_preprocessor
[044]     return self.server(stype, sname, options)
[044]   File "/tarantool/test-run/lib/preprocessor.py", line 351, in server
[044]     return getattr(self, attr)(ctype, sname, opts)
[044]   File "/tarantool/test-run/lib/preprocessor.py", line 209, in server_start
[044]     self.servers[sname].start(silent=True, rais=True, wait=wait,
[044]   File "/tarantool/test-run/lib/tarantool_server.py", line 910, in start
[044]     self.wait_until_started(wait_load, deadline)
[044]   File "/tarantool/test-run/lib/tarantool_server.py", line 1147, in wait_until_started
[044]     self.wait_load(deadline)
[044]   File "/tarantool/test-run/lib/tarantool_server.py", line 1131, in wait_load
[044]     if not self.logfile_pos.seek_wait(msg, p, self.name, deadline):
[044]   File "/tarantool/test-run/lib/tarantool_server.py", line 485, in seek_wait
[044]     log_str = f.readline()
[044]   File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/codecs.py", line 322, in decode
[044]     (result, consumed) = self._buffer_decode(data, self.errors, final)
[044] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 660: invalid continuation byte

At least, I have seen such errors when Tarantool with JIT enabled was tested on macOS ARM64 machines. So this patch fixes the issue.

@coveralls
Copy link

coveralls commented Feb 12, 2024

Coverage Status

coverage: 62.54% (+0.06%) from 62.479%
when pulling 92921d4 on ylobankov/read-logfile-safely
into 52ca8cf on master.

lib/tarantool_server.py Outdated Show resolved Hide resolved
When a diff test starts a Tarantool server, test-run reads the server's
log file and tries to find the message indicating the server is ready.
Sometimes the server's log file may contain bytes that cannot be decoded
by `utf-8` codec and test-run fails with an error like this:

    [044] TarantoolInpector.handle() received the following error:
    [044] Traceback (most recent call last):
    [044]   File "/tarantool/test-run/lib/inspector.py", line 98, in handle
    [044]     result = self.parser.parse_preprocessor(line)
    [044]   File "/tarantool/test-run/lib/preprocessor.py", line 123, in parse_preprocessor
    [044]     return self.server(stype, sname, options)
    [044]   File "/tarantool/test-run/lib/preprocessor.py", line 351, in server
    [044]     return getattr(self, attr)(ctype, sname, opts)
    [044]   File "/tarantool/test-run/lib/preprocessor.py", line 209, in server_start
    [044]     self.servers[sname].start(silent=True, rais=True, wait=wait,
    [044]   File "/tarantool/test-run/lib/tarantool_server.py", line 910, in start
    [044]     self.wait_until_started(wait_load, deadline)
    [044]   File "/tarantool/test-run/lib/tarantool_server.py", line 1147, in wait_until_started
    [044]     self.wait_load(deadline)
    [044]   File "/tarantool/test-run/lib/tarantool_server.py", line 1131, in wait_load
    [044]     if not self.logfile_pos.seek_wait(msg, p, self.name, deadline):
    [044]   File "/tarantool/test-run/lib/tarantool_server.py", line 485, in seek_wait
    [044]     log_str = f.readline()
    [044]   File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/codecs.py", line 322, in decode
    [044]     (result, consumed) = self._buffer_decode(data, self.errors, final)
    [044] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 660: invalid continuation byte

At least, I have seen such errors when Tarantool with JIT enabled was
tested on macOS ARM64 machines. So this patch fixes the issue.
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks OK for me.

@ylobankov ylobankov merged commit 434cbec into master Feb 13, 2024
19 checks passed
@ylobankov ylobankov deleted the ylobankov/read-logfile-safely branch February 13, 2024 12:15
ylobankov added a commit to tarantool/tarantool that referenced this pull request Feb 13, 2024
After we moved osx testing from the per-commit to nightly basis, we
accidentally enabled running tarantool tests on macOS/M1 for 2.10 [1].
So we had some tests failed, and they were fixed by cherry-picking a
few commits from the master branch [2]. Also, some tests were fixed by
updating test-run to the new version [3] with needed fix [4]. So it's
time to fix the last failed test (test/app/digest.test.lua) on macOS/M1
by disabling it due to the issue [5].

[1] #9571
[2] #9672
[3] #9685
[4] tarantool/test-run#422
[5] #6097

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
ylobankov added a commit to tarantool/tarantool that referenced this pull request Feb 13, 2024
After we moved osx testing from the per-commit to nightly basis [1],
we accidentally enabled running tarantool tests on macOS/M1 for 2.10.
So we had some tests failed, and they were fixed by cherry-picking a
few commits from the master branch [2]. Also, some tests were fixed by
updating test-run to the new version [3] with needed fix [4]. So it's
time to fix the last failed test (test/app/digest.test.lua) on macOS/M1
by disabling it due to the issue [5].

[1] #9571
[2] #9672
[3] #9685
[4] tarantool/test-run#422
[5] #6097

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
ylobankov added a commit to tarantool/tarantool that referenced this pull request Feb 13, 2024
After we moved osx testing from the per-commit to nightly basis [1],
we accidentally enabled running tarantool tests on macOS/M1 for 2.10.
So we had some tests failed, and they were fixed by cherry-picking a
few commits from the master branch [2]. Also, some tests were fixed by
updating test-run to the new version [3] with needed fix [4]. So it's
time to fix the last failed test (test/app/digest.test.lua) on macOS/M1
by disabling it due to the issue [5].

[1] #9571
[2] #9672
[3] #9685
[4] tarantool/test-run#422
[5] #6097

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
ylobankov added a commit to tarantool/tarantool that referenced this pull request Feb 13, 2024
After we moved osx testing from the per-commit to nightly basis [1],
we accidentally enabled running tarantool tests on macOS/M1 for 2.10.
So we had some tests failed, and they were fixed by cherry-picking a
few commits from the master branch [2]. Also, some tests were fixed by
updating test-run to the new version [3] with needed fix [4]. So it's
time to fix the last failed test (test/app/digest.test.lua) on macOS/M1
by disabling JIT in it due to the issue [5].

[1] #9571
[2] #9672
[3] #9685
[4] tarantool/test-run#422
[5] #6097

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
ylobankov added a commit to tarantool/tarantool that referenced this pull request Feb 14, 2024
After we moved osx testing from the per-commit to nightly basis [1],
we accidentally enabled running tarantool tests on macOS/M1 for 2.10.
So we had some tests failed, and they were fixed by cherry-picking a
few commits from the master branch [2]. Also, some tests were fixed by
updating test-run to the new version [3] with needed fix [4]. So it's
time to fix the last failed test (test/app/digest.test.lua) on macOS/M1
by disabling JIT in it due to the issue [5].

[1] #9571
[2] #9672
[3] #9685
[4] tarantool/test-run#422
[5] #6097

NO_DOC=testing stuff
NO_TEST=testing stuff
NO_CHANGELOG=testing stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants