Skip to content

tests/library/harness: get rid of warnings on un-closed files #15274

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

Conversation

ijon
Copy link
Collaborator

@ijon ijon commented Mar 3, 2025

tests/library/harness: get rid of warnings on un-closed files.

KiKiMRNode-Daemon manage process of ydb node (ydbd).
Daemon opens stderr, stdout.
KiKiMRNode opens log file.

Change Daemon to open all those files on (every) Daemon.start() and close on (every) Daemon.{stop,kill}() instead of opening them once at KiKiMRNode-Daemon construction and never closing.

Copy link

github-actions bot commented Mar 3, 2025

🟢 2025-03-06 13:54:54 UTC The validation of the Pull Request description is successful.

Copy link

github-actions bot commented Mar 3, 2025

2025-03-03 20:09:15 UTC Pre-commit check linux-x86_64-relwithdebinfo for a3baa88 has started.
2025-03-03 20:09:30 UTC Artifacts will be uploaded here
2025-03-03 20:11:51 UTC ya make is running...
🟡 2025-03-03 20:37:49 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4965 4790 0 47 37 91

2025-03-03 20:38:19 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-03-03 20:51:29 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
195 (only retried tests) 69 0 45 1 80

2025-03-03 20:51:40 UTC ya make is running... (failed tests rerun, try 3)
🟢 2025-03-03 20:55:41 UTC ydbd size 2.1 GiB changed* by 0 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: d35b323 merge: a3baa88 diff diff %
ydbd size 2 288 962 184 Bytes 2 288 962 184 Bytes 0 Bytes 0.000%
ydbd stripped size 479 716 288 Bytes 479 716 288 Bytes 0 Bytes 0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation
2025-03-03 20:55:43 UTC Check cancelled

Copy link

github-actions bot commented Mar 3, 2025

2025-03-03 20:09:30 UTC Pre-commit check linux-x86_64-release-asan for a3baa88 has started.
2025-03-03 20:09:46 UTC Artifacts will be uploaded here
2025-03-03 20:12:14 UTC ya make is running...
🟡 2025-03-03 20:40:42 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1896 1833 0 39 9 15

2025-03-03 20:41:01 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-03-03 20:55:55 UTC ydbd size 3.7 GiB changed* by -96 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: d35b323 merge: a3baa88 diff diff %
ydbd size 3 989 364 912 Bytes 3 989 364 816 Bytes -96 Bytes -0.000%
ydbd stripped size 1 388 709 288 Bytes 1 388 709 224 Bytes -64 Bytes -0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation
2025-03-03 20:55:57 UTC Check cancelled

@ijon ijon force-pushed the tests-harness-get-rid-of-warnings-on-unclosed-files branch from 860160f to b5c94c5 Compare March 3, 2025 20:55
Copy link

github-actions bot commented Mar 3, 2025

2025-03-03 20:57:53 UTC Pre-commit check linux-x86_64-relwithdebinfo for e32bbcb has started.
2025-03-03 20:58:42 UTC Artifacts will be uploaded here
2025-03-03 21:01:36 UTC ya make is running...
🟡 2025-03-03 21:26:59 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4965 4843 0 2 36 84

2025-03-03 21:27:30 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-03-03 21:39:15 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
102 (only retried tests) 25 0 0 0 77

🟢 2025-03-03 21:39:22 UTC Build successful.
🟢 2025-03-03 21:39:34 UTC ydbd size 2.1 GiB changed* by 0 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: d35b323 merge: e32bbcb diff diff %
ydbd size 2 288 962 184 Bytes 2 288 962 184 Bytes 0 Bytes 0.000%
ydbd stripped size 479 716 288 Bytes 479 716 288 Bytes 0 Bytes 0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Mar 3, 2025

2025-03-03 20:59:56 UTC Pre-commit check linux-x86_64-release-asan for e32bbcb has started.
2025-03-03 21:00:12 UTC Artifacts will be uploaded here
2025-03-03 21:02:41 UTC ya make is running...
🟡 2025-03-03 21:29:44 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1896 1871 0 8 5 12

2025-03-03 21:30:02 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-03-03 21:41:27 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
33 (only retried tests) 23 0 0 3 7

🟢 2025-03-03 21:41:33 UTC Build successful.
🟢 2025-03-03 21:41:50 UTC ydbd size 3.7 GiB changed* by -96 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: d35b323 merge: e32bbcb diff diff %
ydbd size 3 989 364 912 Bytes 3 989 364 816 Bytes -96 Bytes -0.000%
ydbd stripped size 1 388 709 288 Bytes 1 388 709 224 Bytes -64 Bytes -0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@@ -92,6 +94,12 @@ def stderr_file_name(self):
else:
return None

def __del__(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Давай лучше в stop засунем? Выглядит так, что вызов stop обязателен в любом случае, а вот del вызывается менее детерминированно

Copy link
Collaborator Author

@ijon ijon Mar 4, 2025

Choose a reason for hiding this comment

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

Я сначала и вставил это в stop(), но оказалось, что есть тесты (около 45, см. первую сборку), в сценариях которых нужно останавливать ноды и запускать снова, объект Daemon при этом не пересоздаётся, -- то есть вызывается stop(), потом start(), и Daemon должен запуститься на тех же файлах, что он открывал в конструкторе.

Тут либо отдельный явный метод подчистки делать (не деструктор, но и не stop или kill) и найти место, где его правильно вызвать. Либо закрывать и открывать файлы заново не в конструкторе, а в stop и start. И возможно получить разные файлы для разных вызовов start (может хорошо, а может быть и неудобно).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Я бы файлы просто с append бы открывал, и пусть пишут свой вывод в конец -- может это решит проблему?

@ijon ijon requested a review from maximyurchuk March 4, 2025 09:37
Copy link

github-actions bot commented Mar 6, 2025

2025-03-06 12:23:42 UTC Pre-commit check linux-x86_64-relwithdebinfo for d7109da has started.
2025-03-06 12:24:08 UTC Artifacts will be uploaded here
2025-03-06 12:26:55 UTC ya make is running...
🟢 2025-03-06 12:53:31 UTC Tests successful.

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
4969 4847 0 0 36 86

🟢 2025-03-06 12:54:02 UTC Build successful.
🟢 2025-03-06 12:54:15 UTC ydbd size 2.1 GiB changed* by -616 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: 77ffed5 merge: d7109da diff diff %
ydbd size 2 293 954 392 Bytes 2 293 953 776 Bytes -616 Bytes -0.000%
ydbd stripped size 480 563 328 Bytes 480 565 568 Bytes +2.2 KiB +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Mar 6, 2025

2025-03-06 12:26:13 UTC Pre-commit check linux-x86_64-release-asan for d7109da has started.
2025-03-06 12:26:28 UTC Artifacts will be uploaded here
2025-03-06 12:28:58 UTC ya make is running...
🟡 2025-03-06 12:57:34 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1898 1876 0 9 4 9

2025-03-06 12:57:53 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-03-06 13:09:20 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
26 (only retried tests) 17 0 0 3 6

🟢 2025-03-06 13:09:26 UTC Build successful.
🟢 2025-03-06 13:09:46 UTC ydbd size 3.7 GiB changed* by -8.9 KiB, which is <= 0 Bytes vs main: OK

ydbd size dash main: 77ffed5 merge: d7109da diff diff %
ydbd size 3 995 175 104 Bytes 3 995 166 000 Bytes -8.9 KiB -0.000%
ydbd stripped size 1 389 081 320 Bytes 1 389 082 888 Bytes +1.5 KiB +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@ijon ijon merged commit 06876fe into ydb-platform:main Mar 6, 2025
14 checks passed
@ijon ijon deleted the tests-harness-get-rid-of-warnings-on-unclosed-files branch March 6, 2025 16:25
blinkov pushed a commit that referenced this pull request Mar 21, 2025
tests/library/harness: get rid of warnings on un-closed files.

`KiKiMRNode`-`Daemon` manage process of ydb node (ydbd).
`Daemon` opens stderr, stdout.
`KiKiMRNode` opens log file.

Change `Daemon` to open all those files on (every) `Daemon.start()` and close on (every) `Daemon.{stop,kill}()` instead of opening them once at `KiKiMRNode`-`Daemon` construction and never closing.
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.

2 participants