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
graalvm native image feature PreComputeFieldFeature disable all netty native transports #31141
Comments
Could you please elaborate on what conditions more specially are false at build time but true at runtime (closed wold assumptions means that the classpath is fixed at build time and native image nature means the Operating System will be the same)?
Could you please share more details about the problem and a reproducer? |
@sdeleuze When i building appliaction on a Ubuntu22.04 machine(same as runtime machine), reactor-netty native transport conditions in the logs above will always be false:
Please focus on the Please see the code of static final boolean isEpollAvailable;
static {
boolean epollCheck = false;
try {
Class.forName("io.netty.channel.epoll.Epoll");
epollCheck = Epoll.isAvailable();
}
catch (ClassNotFoundException cnfe) {
// noop
}
isEpollAvailable = epollCheck;
if (log.isDebugEnabled()) {
log.debug("Default Epoll support : " + isEpollAvailable);
}
}
After the field is always baked to false at compile time, epoll support will be disabled in runtime. Thus cause unix domain socket unavailable. As mentioned above, this problem not only affect Epoll(on Linux), also affect other netty native transport such as KQueue(on Mac). all of these field is baked to false. If that's still not clear enough, I can provide a sample application to reproduce it. |
Could be a missing reflection entry for [
{
"name": "io.netty.channel.epoll.Epoll"
}
] Could you please try with that let me know if it helps? If it does, we can probably ask Reactor team to add such metadata. |
@sdeleuze if i use This means that it's not that Epoll can't be reflected, it's that the Field i will give you a sample application later |
This is my expectation as well, but what I suspect is that on native without a proper reflection entry, That said, it could also be inlined and not require reflection metadata, so let's see with your repro. |
@sdeleuze I create a demo: https://github.com/czp3009/r2dbc-native-image-domain-socket-issue-reproduce Please follow the README to locate problem |
This commit refines Reactor field precomputing on native to only compute at build-time reactor-core fields, since doing so on reactor-netty has unwanted side effects like Epoll always disabled. Closes spring-projectsgh-31141
This commit refines Reactor field precomputing on native to only compute at build-time reactor-core fields, since doing so on reactor-netty has unwanted side effects like Epoll always disabled. Closes spring-projectsgh-31141
During the graalvm native compile, the Spring provided Feature
org.springframework.aot.nativex.feature.PreComputeFieldFeature
will lead to all Netty native transports unavailable.all reactor-netty related log during compile:
This is due to
org.springframework.aot.nativex.feature.PreComputeFieldFeature
contains such a field match pattern: https://github.com/spring-projects/spring-framework/blob/32f128b6ba118ea42f6648cda94ed1de7afa75aa/spring-core/src/main/java/org/springframework/aot/nativex/feature/PreComputeFieldFeature.java#L48C4-L48C4This causes all the properties used by reator-netty to detect native transports to be selected.
All those properties should be init at runtime not build time to let reactor-netty correctly chose netty native transport.
This problem cause broken of using r2dbc with unix domain socket on native image.
I'm not familiar with pattern, but I think it's a good idea to skip the reactor netty properties to fix this issue.
The text was updated successfully, but these errors were encountered: