-
Notifications
You must be signed in to change notification settings - Fork 65
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
do not close file writer upon every log invocation #382
Conversation
bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogWriter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing. Unfortunately this is the first change for the 2023-12 release in org.eclipse.osgi
so we need a version bump to Bundle-Version: 3.18.600.qualifier
in the META-INF/MANIFEST.MF
and to <version>3.18.600-SNAPSHOT</version>
for the pom.xml
Also need to update the versions in org.eclipse.osgi.test
project.
52b89eb
to
532a026
Compare
Thanks for the hints, updated the versions, rebased and squashed commits. |
Closes eclipse-equinox#221. The eager behavior can be enabled by setting configuration eclipse.log.closeFile.eagerClose to true (defaults to false).
532a026
to
e63fa9c
Compare
Thanks for the PR. It is merged now. |
Please take a look on new 5 fails in runtime tests and 7 fails in p2 tests I believe they are all caused by this PR. |
@iloveeclipse @tjwatson the reason these tests are failing is probably cause they all try to delete the frameworks log file which is now locked as there is still an open All tests requiring to work with a "clean" log file for easier log file content verification should simply call Another option is to simply overwrite the log file contents with an empty String (which is pretty similar to deleting the file which is the current attempt in the tests), which works but does not seem as good to me (what if you want the framework log for analysis later on for a failed test but then the content is gone). What do you think? |
I honestly have no time to look into this, but it would be nice to fix the test fails soon in some way, as they prevent people to get green platform builds on PR's. |
This sounds reasonable, @alxflam-work can you provide a PR for the failing tests to do so? |
@laeubi i'd really like to do so, but the situation for me is the following: I only have approval from our internal OSS boards to contribute to the equinox repository. As the failing tests reside in the p2 and eclipse.platform repositories, i'll have to go through some corporate OSS process to get these repositories approved for contributions. Sadly, this can take quite some time. So in the end if i fix the failing tests this will simply take potentially many weeks due to our internal OSS process, which i guess is not acceptable. Therefore, either someone of the eclipse members provides the fix or we revert this PR and we can rework it once i have approval for p2 and eclipse.platform repository contributions? Sorry for the inconveniences caused! What works locally for the P2 repository failing tests ArtifactMirrorApplicationTest & NewMirrorApplicationArtifactTest is this:
The same should work also for the failing test in platform LogSerializationTest, but maybe there junit4 is used and the TemporaryFolder rule could be applied instead. |
@tjwatson if nobody works on fixing the tests please revert, it's very frustrating that whole platform is blocked by the current state. |
It doesn't work. The test deletes the log file / logs in the loop. I believe the change here broke that.
|
For what it helps, note that there is also a system property to disable the new behavior and restore the old behavior... |
The question for me is if that new behavior is working properly.
If that is not working now, I would say it is a regression. The test LogSerializationTest deletes log file, logs something and expect that the content they log appears in the same file. This makes sense, since that is what can happen at any time in a regular environment too. If that is not working anymore, and the log file contains something different / not what the application has most recently logged, looks like a regression. Long story short, I would propose a PR reverting the change, and let @tjwatson & @alxflam-work discuss if the new behavior works as expected, shouldn't be default or just has some implementation bug. |
invocation" This reverts commit 53dc6b6 as it caused test failures in - org.eclipse.core.tests.internal.runtime.LogSerializationTest - org.eclipse.equinox.p2.tests.mirror.ArtifactMirrorApplicationTest - org.eclipse.equinox.p2.tests.mirror.NewMirrorApplicationArtifactTest Note: pom and manifest files are left unchanged to avoid going back with bundle versions. Original PR: eclipse-equinox#382 Original ticket: eclipse-equinox#221
Revert PR: #388 |
invocation" This reverts commit 53dc6b6 as it caused test failures in - org.eclipse.core.tests.internal.runtime.LogSerializationTest - org.eclipse.equinox.p2.tests.mirror.ArtifactMirrorApplicationTest - org.eclipse.equinox.p2.tests.mirror.NewMirrorApplicationArtifactTest Note: pom and manifest files are left unchanged to avoid going back with bundle versions. Original PR: #382 Original ticket: #221
Revert was the right thing to do, although the details on if the file is closed or not are an implementation detail, not an API for the log file. @alxflam-work you will either need to fix the tests, or more likely flip the default to be the old behavior. |
@tjwatson then i'll provide a PR with the same changes, but defaulting to the old behavior. Once that is done, i can adapt the tests to no longer delete the log file but instead use a dedicated tmp log file - which should not be a semantic change for the tests. The tests should then still be green and afterwards we could flip the default behavior. |
@alxflam-work if you propose a new PR please test the mentioned Tests before. It's not enough to assume they would work. |
Hi,
this PR resolves issue #221:
log
invocationlog
only if anException
is thrown, then the writer is closed immediately. Additionally,closeFile
is called also after the writer changed to write to std.err in thecatch
block (else that writer instance would not be closed)writer
is still closed, akacloseFile
is called, when the actual log file changes (e.g. explicitly or due to log file rotation caused by size limit)EquinoxLogWriterTest
to verify that logs areflushed
immediately but thewriter
is not closed. I tried my best with the Junit4 environment and missing mockito, please let me know if i can improve the testcase. For now, my only solution was using reflection to actually verify the invocations on thewriter
.All OSGi Tests
launch config runs locally without errors (with these changes)Greetings,
Alex