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

Issue #6354 - OSGI manifest for slf4j-api packages lower limit should be 1.7 #6381

Merged
merged 4 commits into from Jun 10, 2021

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Jun 9, 2021

The existing OSGi manifests for org.slf4j in Jetty 10.0.4 are broken.

They list only 1 out of the 4 packages that need import, and a few or our modules did not pull in the updated version range properly.

This PR fixes the top level configuration to include all 4 packages, and uses it in modules that declare their own Import-Package specifics.

Signed-off-by: Joakim Erdfelt joakim.erdfelt@gmail.com

… be 1.7

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime self-assigned this Jun 9, 2021
@joakime joakime added this to In progress in Jetty 10.0.5/11.0.5 FROZEN via automation Jun 9, 2021
@joakime joakime added Bug For general bugs on Jetty side High Priority labels Jun 9, 2021
@joakime
Copy link
Contributor Author

joakime commented Jun 9, 2021

The Eclipse IDE side issue that needs the OSGI manifest fix from this PR is ...

https://bugs.eclipse.org/bugs/show_bug.cgi?id=573454

@jonahgraham
Copy link

@nitind this appears to resolve the WTP problem that "jetty-jndi and jetty-plus did not have their SLF4J ranges lowered under 2.0". Are you able to test to see if the 10.0.5 snapshot that @joakime put out resolves that and means that no slf4j 2 ends up in https://download.eclipse.org/webtools/jetty/10.0.4/repository/plugins/ equivalent?

@joakime
Copy link
Contributor Author

joakime commented Jun 9, 2021

I haven't pushed the SNAPSHOT with the PR changes yet.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@nitind
Copy link

nitind commented Jun 9, 2021

@jonahgraham I should be able to once the snapshots are up, but the process we use for our build doesn't modify the manifests aside from embedding SHA-256-Digests within them, so what Jetty creates is basically what we use.

@joakime
Copy link
Contributor Author

joakime commented Jun 9, 2021

I had to push a small fix in commit 8193af6 - i'm going to wait for CI to give a green light before i build the snapshot for you.

@olamy
Copy link
Member

olamy commented Jun 9, 2021

@nitind @jonahgraham snapshots deployed to https://oss.sonatype.org/content/repositories/jetty-snapshots

@nitind
Copy link

nitind commented Jun 9, 2021

@nitind @jonahgraham snapshots deployed to https://oss.sonatype.org/content/repositories/jetty-snapshots

All of the manifests look good to me. Output from my local build still includes a slf4j.api_2.0.0.alpha1.jar, but that must be because it's technically newer and not a snapshot.

@olamy
Copy link
Member

olamy commented Jun 10, 2021

@nitind feel free to approve the PR ;)

@jonahgraham
Copy link

@nitind @jonahgraham snapshots deployed to https://oss.sonatype.org/content/repositories/jetty-snapshots

All of the manifests look good to me. Output from my local build still includes a slf4j.api_2.0.0.alpha1.jar, but that must be because it's technically newer and not a snapshot.

I suspect there are two reasons it is included:

  1. If you based your build off of what Eclipse Platform did, then the category.xml explicitly lists org.slf4j
  2. The version it pulls in is presumably the version that the Jetty's pom.xml's dependencyManagement - see: https://github.com/eclipse/jetty.project/blob/8193af67ef800fe4263274ab5dc96b73b442c329/pom.xml#L22 and https://github.com/eclipse/jetty.project/blob/8193af67ef800fe4263274ab5dc96b73b442c329/pom.xml#L1166-L1170

If that sounds correct, then perhaps this change to Platform's build can be applied to WTPs too? https://git.eclipse.org/r/c/platform/eclipse.platform.releng.buildtools/+/181742

Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor

We need to make sure that the osgi tests run against slf4j 1.7.30 to have some kind of assurance that indeed jetty will deploy into osgi against an slf4j version lower than 2.0.0. I've done the changes to do that and committed to this PR: it wasn't pretty. Note that the demo-jetty-webapp was relying on slf4j 2.0.0, along with the jetty-slf4j-logging impl: I've had to remove that reliance because whilst it's perfectly possible to deploy both slf4j-api 2.0.0 and slf4j-api-1.7.30 at the same time, it isn't possible to ensure that all our jars only resolve against the 1.7.30 (ie what we're trying to test!). So I've changed the demo-jetty-webapp to only log to the servlet context logger. I'm not even sure that any logging is necessary at all - we should review that.

I've made the test-jetty-osgi module use slf4j 1.7.30, and now all of the tests run correctly, so we have some level of assurance that this fix works. Unfortunately, changing the logging level in the simplelogger.properties file I've provided isn't changing the jetty logging, so it's now harder to debug osgi tests. I think there's some conflict with pax-exam slf4j logging, but that needs further investigation.

So, AFAICT the fix in this PR works, however, I think it is an extremely fragile fix: the next person who creates a jetty module that specifies a custom Import statement in the pom.xml probably won't know that they need to use this special ${osgi.common.import.packages} value to make logging work.

A far better solution would be to make all of jetty rely on the lowest level of slf4j at build time (ie 1.7.30), and then make sure that with jetty.home we deploy against the higher version of slf4j (2.0.0). Note that we would need to change the jetty-slf4j-logging implementation to work against 1.7.30 - currently it doesn't because the way 1.7.30 finds its impl is different to 2.0.0 - I've raised issue #6385.

So now that I've committed code to this branch, I think we need to ask somebody else to review this.

pom.xml Outdated
@@ -45,6 +45,9 @@
<jetty.perf-helper.version>1.0.6</jetty.perf-helper.version>
<ant.version>1.10.9</ant.version>
<unix.socket.tmp></unix.socket.tmp>
<!-- OSGI import-package -->
<osgi.common.import.packages>org.slf4j;version="[1.7,3.0)", org.slf4j.event;version="[1.7,3.0)", org.slf4j.helpers;version="[1.7,3.0)", org.slf4j.spi;version="[1.7,3.0)"</osgi.common.import.packages>
Copy link
Contributor

Choose a reason for hiding this comment

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

This property should be renamed to slf4j.import.packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, as that is how it is currently used.
But using the more generic osgi.common.* prefix means we can add to this list for other reasons without having to touch all of the locations that use this new property again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about osgi.slf4j.import.packages?
I don't what to drop the osgi portion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to osgi.slf4j.import.packages instead in commit 4720f07

Jetty 10.0.5/11.0.5 FROZEN automation moved this from In progress to Review in progress Jun 10, 2021
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@jonahgraham
Copy link

Thank you Jetty team for all your work supporting the 2021-06 Eclipse SimRel release! Can you give us an ETA / time-range for a possible 10.0.5 release? The 2021-06 ship date is Wed 16 and the planning council needs some guidance so that we can start planning for a slip on the release day if needed. AFAICT the release engineering to respin is happening in (at least) 4 very disparate different timezones (Australia, India, Germany, Canada). Thanks again!

@sbordet
Copy link
Contributor

sbordet commented Jun 10, 2021

@jonahgraham we are processing the release in #6390.

I'm merging the latest PR and then I will deploy a 10.0.5-SNAPSHOT; I will notify here when the snapshot is deployed.

Will be great if you can thoroughly test that snapshot and confirm that it works.

@sbordet sbordet self-requested a review June 10, 2021 14:01
Jetty 10.0.5/11.0.5 FROZEN automation moved this from Review in progress to Reviewer approved Jun 10, 2021
@sbordet sbordet merged commit d997a11 into jetty-10.0.x Jun 10, 2021
Jetty 10.0.5/11.0.5 FROZEN automation moved this from Reviewer approved to Done Jun 10, 2021
@sbordet sbordet deleted the jetty-10.0.x-6354-osgi-slf4j-import branch June 10, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side High Priority
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

org.slf4j dependency imports osgi packages at 2.0
6 participants