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

Revert change client proxy class package #23185

Merged

Conversation

aloubyansky
Copy link
Member

@mkouba i'm opening this one in the meantime. Unless we find a proper fix for 2.7.0.Final by tonight, we should merge this one and look for a proper fix for 2.7.1.

Fixes #23167

@quarkus-bot quarkus-bot bot added the area/arc Issue related to ARC (dependency injection) label Jan 25, 2022
@mkouba
Copy link
Contributor

mkouba commented Jan 25, 2022

@mkouba i'm opening this one in the meantime. Unless we find a proper fix for 2.7.0.Final by tonight, we should merge this one and look for a proper fix for 2.7.1.

Fixes #23167

I don't think that we should revert the fix for #22815 because #23167 only affects the dev mode while the original issue breaks an app in prod mode.

I believe that quarkus.class-loading.reloadable-artifacts can be used as a workaround.

@gsmet
Copy link
Member

gsmet commented Jan 25, 2022

@mkouba well except the case of @Postremus looks relatively common and is a regression? Whereas the other case requires the open telemetry extension.

I certainly don't want us to introduce a regression to fix something that wasn't working before.

@mkouba
Copy link
Contributor

mkouba commented Jan 25, 2022

well except the case looks relatively common and is a regression?

Well, it requires a normal-scoped producer bean placed in the application and this producer must return a type from an external library.

I certainly don't want us to introduce a regression to fix something that wasn't working before.

For me the regression has a lower priority because 1) it's dev mode only, 2) there is a workaround.

@gsmet
Copy link
Member

gsmet commented Jan 25, 2022

Well, dev mode is the normal mode for developing applications. So it's not less important than production mode. And while I think a workaround for @Postremus is acceptable, I wouldn't want us to have a ton of people complaining about this and having to implement the workaround.

I would have agreed with you if I had to choose between two regressions but here we have to choose between introducing a regression and fixing something that wasn't working.

So my personal opinion is that we should revert for .0.Final and decide what to do for .1.Final

@gsmet
Copy link
Member

gsmet commented Jan 25, 2022

BTW, I'm not saying that this should be reverted forever. I just think we need more time to think about what to do and probably involve @stuartwdouglas and @geoand .
That's not something we can do in the time frame we have.

@mkouba
Copy link
Contributor

mkouba commented Jan 25, 2022

Well, dev mode is the normal mode for developing applications. So it's not less important than production mode.

My point is that we can't gurantee the same level of stability for the dev mode. Of course, the dev mode is very important but there were, there are and there will be issues originating from the difference in classloading. That said, if I should choose between a regression in the dev mode and a fix for the prod mode I'd take the latter.

BTW, I'm not saying that this should be reverted forever. I just think we need more time to think about what to do and probably involve @stuartwdouglas and @geoand.

+1

@aloubyansky
Copy link
Member Author

I think it depends on what we would like to see as a proper fix, base/runtime split and how we achieve it. If we are not yet sure the current fix is in line with that, it makes sense to discuss it more.

After looking into a few classloading issues recently that are due to the base/runtime split, I think we should review the way we are doing it. I think it's about time. It looks like it was inevitable to run into these issues with maturity of the project.

@mkouba
Copy link
Contributor

mkouba commented Jan 25, 2022

Whereas the other case requires the open telemetry extension.

BTW this is not the case. It's just that the other issue is demonstrated by the telemetry extension, i.e. it's a more general problem.

@gsmet
Copy link
Member

gsmet commented Jan 25, 2022

That said, if I should choose between a regression in the dev mode and a fix for the prod mode I'd take the latter.

Let's agree to disagree :). We are advertising dev mode as the primary way to develop applications so breaking it is a problem. Even if there is a workaround. I prefer keeping something that was not working until now.

I will pursue with the revert as soon as CI is green and I'll let you, @aloubyansky, @stuartwdouglas and @geoand discuss what we should do for 2.7.1.Final.

@mkouba
Copy link
Contributor

mkouba commented Jan 25, 2022

That said, if I should choose between a regression in the dev mode and a fix for the prod mode I'd take the latter.

Let's agree to disagree :). We are advertising dev mode as the primary way to develop applications so breaking it is a problem. Even if there is a workaround. I prefer keeping something that was not working until now.

I will pursue with the revert as soon as CI is green and I'll let you, @aloubyansky, @stuartwdouglas and @geoand discuss what we should do for 2.7.1.Final.

🤷

@gsmet gsmet merged commit 6de2f0a into quarkusio:main Jan 25, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Jan 25, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.0.Final Jan 25, 2022
@mkouba
Copy link
Contributor

mkouba commented Feb 8, 2022

So I was looking at how quarkus.class-loading.reloadable-artifacts is implemented and it seems that the only thing we can do with the current architecture is to fail the build or log a warning :-(.

Just to be clear - the original fix in #22828 changed the package where a client proxy is generated for a CDI producer. Previously, it was the package of the declaring bean class. After the fix, it's the package of the return type. This setup prevents from IllegalAccessErrors caused by accessing package-private members of the proxied class.

WDYT? @aloubyansky @stuartwdouglas @geoand

@geoand
Copy link
Contributor

geoand commented Feb 8, 2022

So I was looking at how quarkus.class-loading.reloadable-artifacts is implemented and it seems that the only thing we can do with the current architecture is to fail the build or log a warning :-(.

Seems fair enough to me...

@aloubyansky
Copy link
Member Author

The tests added in this PR would fail now in main, right? My question would be whether the generated proxies should either always be among the reloadable deps or not.

@aloubyansky
Copy link
Member Author

Ok, they are in the runtime CL while the classes the proxies were generated for are in the base CL. I need to look into the tests.

@mkouba
Copy link
Contributor

mkouba commented Feb 8, 2022

The tests added in this PR would fail now in main, right?

Yes, the reverted tests should fail in main.

My question would be whether the generated proxies should either always be among the reloadable deps or not. Ok, they are in the runtime CL while the classes the proxies were generated for are in the base CL.

Hm, I think that it would not help to place all generated proxies in the runtime CL because we won't be able to access package-private members anyway (because the classes need to be loaded from the same ClassLoader). Also think about split-packages...

@aloubyansky
Copy link
Member Author

Right. So if we re-applied your fix, for a use-case like in the #23167 reproducer, making the client proxy an "application class" would work. But if it's modified to mimic the test you added, i.e. making the Configuraiton ctor package-private and adding a public static newInstance(), we'll be back to the original issue of the IllegalAccessError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LinkageError when hot reloading project using classes in external dependencies
4 participants