Skip to content

Commit 94c1bdb

Browse files
committed
fix: native transports, pt2
Signed-off-by: Sam Gammon <sam@elide.dev>
1 parent 00be652 commit 94c1bdb

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

packages/cli/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,8 +1387,8 @@ val commonNativeArgs = listOfNotNull(
13871387
"-H:ExcludeResources=org/graalvm/shadowed/com/ibm/icu/impl/data/icudt74b/coll/ko.res",
13881388
"-H:ExcludeResources=org/graalvm/shadowed/com/ibm/icu/impl/data/icudt74b/brkitr/burmesedict.dict",
13891389
"-H:ExcludeResources=org/graalvm/shadowed/com/ibm/icu/impl/data/icudt74b/brkitr/thaidict.dict",
1390-
"-H:ExcludeResources=META-INF/native/libnetty_transport_native_epoll_aarch_64.so",
1391-
"-H:ExcludeResources=META-INF/native/libnetty_transport_native_io_uring_x86_64.so",
1390+
// "-H:ExcludeResources=META-INF/native/libnetty_transport_native_epoll_aarch_64.so",
1391+
// "-H:ExcludeResources=META-INF/native/libnetty_transport_native_io_uring_x86_64.so",
13921392
"-Delide.strict=true",
13931393
"-Delide.js.vm.enableStreams=true",
13941394
"-Delide.mosaic=$enableMosaic",
@@ -1796,7 +1796,7 @@ val linuxOnlyArgs = defaultPlatformArgs.plus(
17961796
"-H:ExcludeResources=.*dll",
17971797
"-H:ExcludeResources=META-INF/native/libsqlitejdbc-linux-amd64.so",
17981798
"-H:ExcludeResources=lib/osx-aarch64/libbrotli.dylib",
1799-
"-H:ExcludeResources=META-INF/native/libnetty_transport_native_epoll_x86_64.so",
1799+
// "-H:ExcludeResources=META-INF/native/libnetty_transport_native_epoll_x86_64.so",
18001800
"-H:ExcludeResources=META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib",
18011801
"--initialize-at-run-time=io.netty.channel.kqueue.Native",
18021802
"--initialize-at-run-time=io.netty.channel.kqueue.KQueueEventLoop",

packages/cli/src/main/resources/META-INF/native-image/dev/elide/elide-cli/reachability-metadata.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"reflection": [
3+
{
4+
"type": "sun.nio.ch.EPollSelectorImpl",
5+
"allDeclaredFields": true,
6+
"allDeclaredMethods": true,
7+
"allDeclaredConstructors": true
8+
},
39
{
410
"type": "Main",
511
"methods": [

packages/graalvm/src/main/kotlin/elide/runtime/intrinsics/server/http/netty/NettyTransport.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import io.netty.incubator.channel.uring.IOUring
3030
import io.netty.incubator.channel.uring.IOUringEventLoopGroup
3131
import io.netty.incubator.channel.uring.IOUringServerSocketChannel
3232
import kotlin.reflect.KClass
33+
import elide.runtime.Logging
3334
import elide.runtime.intrinsics.server.http.netty.NettyTransport.Companion.resolve
3435

3536
/**
@@ -51,23 +52,28 @@ internal sealed interface NettyTransport<T : ServerSocketChannel> {
5152
try {
5253
scope.group(eventLoopGroup())
5354
scope.channel(socketChannel().java)
54-
} catch (_: UnsatisfiedLinkError) {
55+
} catch (err: UnsatisfiedLinkError) {
56+
logging.warn { "Falling back to NIO; native transport could not load: '${err.message}'" }
5557
scope.group(NioEventLoopGroup())
5658
scope.channel(NioServerSocketChannel::class.java)
5759
}
5860
}
5961

6062
companion object {
63+
private val logging by lazy {
64+
Logging.of(NettyTransport::class)
65+
}
66+
6167
/** Resolve a [NettyTransport] implementation for the current platform. */
6268
internal fun resolve(): NettyTransport<*> = when {
6369
// prefer `io_uring` if available (Linux-only, modern kernels)
6470
IOUring.isAvailable() -> IOUringTransport
6571

6672
// next up, prefer `epoll` if available (Linux-only, nearly all kernels)
67-
// Epoll.isAvailable() -> EpollTransport
73+
Epoll.isAvailable() -> EpollTransport
6874

6975
// next up, opt for `kqueue` on Unix-like systems
70-
// KQueue.isAvailable() -> KQueueTransport
76+
KQueue.isAvailable() -> KQueueTransport
7177

7278
// otherwise, fallback to NIO
7379
else -> NioTransport

0 commit comments

Comments
 (0)