[
https://issues.apache.org/jira/browse/SLING-11916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776887#comment-17776887
]
Mark Adamcin commented on SLING-11916:
--------------------------------------
[~sseifert] I was able to trace this locally and in
[Jenkins|https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-34/1/pipeline]
after adding logging and moving the assertion into the DummyEventHandler class
so the failed condition could be examined when it occurred. Then I just ran it
a bunch until it failed. When it did fail, this log message was repeated until
the timeout, which points to out-of-order delivery of EVENT_SAMPLE_2, and
EVENT_OTHER_3:
{code:java}
[Time-limited test] ERROR org.apache.sling.testing.mock.osgi.MockEventAdminTest
- missed expectations [org.osgi.service.event.Event [topic=sample/topic2] {},
org.osgi.service.event.Event [topic=other/topic3] {}] received
[org.osgi.service.event.Event [topic=other/topic3] {},
org.osgi.service.event.Event [topic=sample/topic2] {}] {code}
According to
[https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.event.html#i1556001]
the default async delivery behavior should be ordered, rather than each event
being delivered on its own thread as
[MockEventAdmin|https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/907dbbd5e6707b6be5f19f8af6dedcd6cdf2f87d/core/src/main/java/org/apache/sling/testing/mock/osgi/MockEventAdmin.java#L74-L91]
is currently doing:
{code:java}
@Override
public void postEvent(final Event event) {
if (log.isDebugEnabled()) {
log.debug("Send event: {}, bundleContext={}", event.getTopic(),
this.bundleContext);
}
try {
asyncHandler.execute(new Runnable() {
@Override
public void run() {
distributeEvent(event);
}
});
}
catch (RejectedExecutionException ex) {
// ignore
log.debug("Ignore rejected execution: " + ex.getMessage(), ex);;
}
} {code}
> osgi-mock: MockEventAdminTest.testPostEvents times out on Jenkins/Windows
> -------------------------------------------------------------------------
>
> Key: SLING-11916
> URL: https://issues.apache.org/jira/browse/SLING-11916
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Robert Munteanu
> Priority: Major
> Fix For: Testing OSGi Mock 3.4.0
>
>
> The error is
>
> {noformat}
> [ERROR] org.apache.sling.testing.mock.osgi.MockEventAdminTest.testPostEvents
> Time elapsed: 3.02 s <<< ERROR!
> org.junit.runners.model.TestTimedOutException: test timed out after 3000
> milliseconds
> {noformat}
> and seems to affect both Java 11 and 17.
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-27/1/pipeline
> (Java 11, Windows)
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/229/pipeline
> (Java 17, Windows)
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/228/pipeline
> (Java 17, Windows)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)