nanovms / nanos

A kernel designed to run one and only one application in a virtualized environment
https://nanos.org
Apache License 2.0
2.59k stars 136 forks source link

tracking tkt for vert.x #824

Open eyberg opened 5 years ago

eyberg commented 5 years ago

https://vertx.io/ - if we can get hello world working here..

eyberg commented 5 years ago

using the example here -> https://github.com/vert-x3/vertx-examples/tree/master/maven-simplest - it's pretty straight-forward (for a java project) to get going

although like most of the other java programs it crashes w/page violations or 3 out of 4 times

{
  "Args": ["-Dos.name=Linux", "-jar", "/target/maven-simplest-3.7.1-fat.jar"],
  "Files": ["target/maven-simplest-3.7.1-fat.jar"],
  "Dirs": ["tmp"]
}

(i also needed to create a tmp dir) - not sure if we are missing something here.

sometimes it'll accept a request but then kill it cause of this ->

eyberg@dungeon:~/vertx-examples/maven-simplest$ ops load java_1.8.0_191 -p 8080 -c config.json
warning: overwriting existing file /etc/resolv.conf hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/etc/resolv.conf new: /home/eyberg/.ops/java_temp/resolv.conf
warning: overwriting existing file /proc/sys/kernel/hostname hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/proc/sys/kernel/hostname new: /home/eyberg/.ops/java_temp/hostname
[java -Dos.name=Linux -jar /target/maven-simplest-3.7.1-fat.jar]
booting /home/eyberg/.ops/images/java.img ...
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
assigned: 10.0.2.15
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed

May 23, 2019 8:57:35 PM io.netty.util.NetUtil <clinit>
WARNING: Failed to retrieve the list of available network interfaces
java.net.SocketException: Function not implemented (ioctl(SIOCGIFCONF) failed)
        at java.net.NetworkInterface.getAll(Native Method)
        at java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:355)
        at io.netty.util.NetUtil.<clinit>(NetUtil.java:168)
        at io.netty.channel.socket.InternetProtocolFamily.<clinit>(InternetProtocolFamily.java:28)
        at io.netty.resolver.dns.DnsNameResolver.<clinit>(DnsNameResolver.java:92)
        at io.netty.resolver.dns.DnsNameResolverBuilder.<init>(DnsNameResolverBuilder.java:49)
        at io.netty.resolver.dns.DnsAddressResolverGroup.<init>(DnsAddressResolverGroup.java:64)
        at io.vertx.core.impl.resolver.DnsResolverProvider$1$1.<init>(DnsResolverProvider.java:137)
        at io.vertx.core.impl.resolver.DnsResolverProvider$1.newResolver(DnsResolverProvider.java:137)
        at io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:69)
        at io.vertx.core.impl.AddressResolver.resolveHostname(AddressResolver.java:82)
        at io.vertx.core.impl.VertxImpl.resolveAddress(VertxImpl.java:803)
        at io.vertx.core.net.impl.AsyncResolveConnectHelper.doBind(AsyncResolveConnectHelper.java:82)
        at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:304)
        at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:190)
        at io.vertx.core.http.impl.HttpServerImpl.listen(HttpServerImpl.java:181)
        at io.vertx.example.HelloWorldEmbedded.main(HelloWorldEmbedded.java:13)

after that it just makes up a random mac address

May 23, 2019 8:57:36 PM io.netty.util.internal.MacAddressUtil defaultMachineId
WARNING: Failed to find a usable hardware address from the network interfaces; using random bytes: f9:92:62:8c:5a:1e:00:c2

idk if it's following back on SIOCGIFCONF for lack of something else but i don't think so prob need to add support for that

https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/if_index.c.html

eyberg commented 5 years ago

https://github.com/nanovms/nanos/issues/840

eyberg commented 5 years ago

w/the SIOCGIFADDR support we now get to ->


Jun 06, 2019 8:13:16 PM io.netty.channel.socket.nio.NioServerSocketChannel doReadMessages
WARNING: Failed to create a new channel from an accepted socket.
io.netty.channel.ChannelException: java.net.SocketException: No message of desired type
        at io.netty.channel.socket.DefaultSocketChannelConfig.getSendBufferSize(DefaultSocketChannelConfig.java:142)
        at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.calculateMaxBytesPerGatheringWrite(NioSocketChannel.java:518)
        at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:468)
        at io.netty.channel.socket.nio.NioSocketChannel$NioSocketChannelConfig.<init>(NioSocketChannel.java:464)
        at io.netty.channel.socket.nio.NioSocketChannel.<init>(NioSocketChannel.java:105)
        at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:147)
        at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:483)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: No message of desired type
        at sun.nio.ch.Net.getIntOption0(Native Method)
        at sun.nio.ch.Net.getSocketOption(Net.java:363)
        at sun.nio.ch.SocketChannelImpl.getOption(SocketChannelImpl.java:224)
        at sun.nio.ch.SocketAdaptor.getIntOption(SocketAdaptor.java:298)
        at sun.nio.ch.SocketAdaptor.getSendBufferSize(SocketAdaptor.java:355)
        at io.netty.channel.socket.DefaultSocketChannelConfig.getSendBufferSize(DefaultSocketChannelConfig.java:140)
        ... 13 more

Jun 06, 2019 8:13:16 PM io.netty.channel.socket.nio.NioServerSocketChannel doReadMessages
WARNING: Failed to close a socket.
java.io.IOException: Function not implemented
        at sun.nio.ch.FileDispatcherImpl.preClose0(Native Method)
        at sun.nio.ch.SocketDispatcher.preClose(SocketDispatcher.java:59)
        at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(SocketChannelImpl.java:838)
        at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:234)
        at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:115)
        at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:154)
        at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:483)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
eyberg commented 5 years ago

https://github.com/nanovms/nanos/issues/853

eyberg commented 5 years ago

now up to ->

eyberg@bob:~/vertx-examples/maven-simplest$ ops load java_1.8.0_191 -p 8080 -c config.json
Downloading.. https://storage.googleapis.com/packagehub/manifest.json
 4.63 KiB / 4.63 KiB [===============================================================================================================================================================] 100.00% 2.71 MiB/s 0s
warning: overwriting existing file /etc/resolv.conf hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/etc/resolv.conf new: /home/eyberg/.ops/java_temp/resolv.conf
warning: overwriting existing file /proc/sys/kernel/hostname hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/proc/sys/kernel/hostname new: /home/eyberg/.ops/java_temp/hostname
[java -Dos.name=Linux -jar /target/maven-simplest-3.7.1-fat.jar]
booting /home/eyberg/.ops/images/java.img ...
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
assigned: 10.0.2.15
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed
Jul 24, 2019 4:45:27 PM io.netty.util.NetUtil <clinit>
WARNING: Failed to find the loopback interface
Jul 24, 2019 4:45:28 PM io.netty.util.internal.MacAddressUtil defaultMachineId
WARNING: Failed to find a usable hardware address from the network interfaces; using random bytes: fc:ae:cf:f7:6a:ce:d8:a2
unix_fault_page error: no vmap found for vaddr 0x3b
Unhandled: 000000000000000e
Page fault
interrupt: 000000000000000e
frame: 0000000101001700
error code: 0000000000000010
address: 000000000000003b
  rax: 0000000100a0f000
  rbx: 000000010052c2e0
  rcx: 0000000000000001
  rdx: 0000000000000002
  rsi: 0000000000000005
  rdi: 0000000100a0f000
  rbp: 000000007f9c8ee0
  rsp: 000000007f9c8ed8
   r8: 0000000000000000
   r9: 0000000000000000
  r10: 0000000000000000
  r11: 0000000000000246
  r12: 0000000000000000
  r13: 000000706820657c
  r14: 000000007f0846c8 (bootstrap_region + 0000000000000b28/0000000000200000)
  r15: 0000000000000000
  rip: 000000000000003b
flags: 0000000000000006
   ss: 0000000000000010
   cs: 0000000000000008
   ds: 0000000000000000
   es: 0000000000000000
   fs: 0000000000000000
   gs: 0000000000000000

frame trace:
000000007f051bb9
000000007f051ee0        (futex + 0000000000000320/0000000000000b0b)
000000007f0439cf        (syscall_debug + 00000000000000ff/000000000000029e)
000000007f0002d2        (syscall_enter + 000000000000006a/0000000000000072)
0000000000000000

stack trace:
000000007f060d65        (runloop + 0000000000000015/0000000000000083)
000000007f9c8ef0
000000007f051bb9
000000007f9c8f80
000000007f051ee0        (futex + 0000000000000320/0000000000000b0b)
000000007f9c8f30
0000000000000000
0000000098efee84
0000000000000001
0000000000000000
0000007000000080
00000070e0401000
0000000000000001
000000007f9c8f50
d32a8806d90681c6
000000007f9c8f60
0000000100a0fc00
00000000000000ca
0000000100a0fc00
0000000000000000
000000007f051bc0        (futex + 0000000000000000/0000000000000b0b)
000000007f9c8fe0
000000007f0439cf        (syscall_debug + 00000000000000ff/000000000000029e)
0000000000000000

halt
exit status 255
eyberg commented 4 years ago

this is now working although throws an error for a missing SO_LINGER getsockopt

https://notes.shichao.io/unp/ch7/#so_linger-socket-option

eyberg@dungeon:~/vertx-examples/maven-simplest$  ops load java_1.8.0_191 -p 8080 -c config.json
warning: overwriting existing file /etc/resolv.conf hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/etc/resolv.conf new: /tmp/java_temp452694832/resolv.conf
warning: overwriting existing file /proc/sys/kernel/hostname hostpath old: /home/eyberg/.ops/.staging/java_1.8.0_191/sysroot/proc/sys/kernel/hostname new: /tmp/java_temp452694832/hostname
[java -Dos.name=Linux -jar /target/maven-simplest-3.7.1-fat.jar]
booting /home/eyberg/.ops/images/java.img ...
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
assigned: 10.0.2.15
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed
Dec 03, 2019 6:35:55 PM io.netty.util.NetUtil <clinit>
WARNING: Failed to find the loopback interface
Dec 03, 2019 6:35:56 PM io.netty.util.internal.MacAddressUtil defaultMachineId
WARNING: Failed to find a usable hardware address from the network interfaces; using random bytes: 86:c0:b1:bb:60:cd:68:eb
getsockopt error: getsockopt unimplemented optname: fd 32, level 1, optname 13
getsockopt error: getsockopt unimplemented optname: fd 32, level 1, optname 13
getsockopt error: getsockopt unimplemented optname: fd 32, level 1, optname 13
getsockopt error: getsockopt unimplemented optname: fd 32, level 1, optname 13
eyberg@dungeon:/tmp$ curl -XGET http://127.0.0.1:8080
Hello World!eyberg@dugrep getsockopt /tmp/outfile.strace 0.1:8080
28385 getsockopt(208, SOL_SOCKET, SO_SNDBUF, [2626560], [4]) = 0
28385 getsockopt(208, SOL_SOCKET, SO_SNDBUF, [2626560], [4]) = 0
28495 getsockopt(208, SOL_SOCKET, SO_LINGER, {l_onoff=0, l_linger=0}, [8]) = 0
28495 getsockopt(208, SOL_SOCKET, SO_LINGER, {l_onoff=0, l_linger=0}, [8]) = 0
28385 getsockopt(208, SOL_SOCKET, SO_SNDBUF, [2626560], [4]) = 0
28385 getsockopt(208
eyberg commented 4 years ago

https://github.com/nanovms/nanos/commit/89ca8ee627cd6bcd820e6380c9c2cd8ee101e0f3

francescolavra commented 1 year ago

Successfully tested helloworld example from https://github.com/vert-x3/vertx-examples/tree/4.x/web-examples/src/main/java/io/vertx/example/web/helloworld with vert.x v4.4.5 and java package v20.0.1:

$ cat config-vertx.json 
{
  "Files": ["vertx-core-4.4.5.jar", "vertx-web-4.4.5.jar", "vertx-auth-common-4.4.5.jar", "netty-handler-4.1.97.Final.jar", "netty-buffer-4.1.97.Final.jar", "netty-common-4.1.97.Final.jar", "netty-transport-4.1.97.Final.jar", "netty-resolver-4.1.97.Final.jar", "netty-codec-4.1.97.Final.jar", "netty-handler-proxy-4.1.97.Final.jar", "netty-codec-socks-4.1.97.Final.jar", "netty-codec-http-4.1.97.Final.jar", "netty-codec-http2-4.1.97.Final.jar", "netty-resolver-dns-4.1.97.Final.jar"],
  "Dirs": ["vertx-examples"],
  "RunConfig": {
    "Ports": ["8080"]
  },
  "Args": ["-cp", "vertx-examples/web-examples/src/main/java:vertx-core-4.4.5.jar:vertx-web-4.4.5.jar:vertx-auth-common-4.4.5.jar:netty-handler-4.1.97.Final.jar:netty-buffer-4.1.97.Final.jar:netty-common-4.1.97.Final.jar:netty-transport-4.1.97.Final.jar:netty-resolver-4.1.97.Final.jar:netty-codec-4.1.97.Final.jar:netty-handler-proxy-4.1.97.Final.jar:netty-codec-socks-4.1.97.Final.jar:netty-codec-http-4.1.97.Final.jar:netty-codec-http2-4.1.97.Final.jar:netty-resolver-dns-4.1.97.Final.jar", "io.vertx.example.web.helloworld.Server"]
}
$ ops pkg load eyberg/java:20.0.1 -c config-vertx.json
running local instance
booting /home/francesco/.ops/images/java ...
en1: assigned 10.0.2.15
en1: assigned FE80::54B8:1BFF:FE51:8561
Sep 08, 2023 11:23:07 AM io.vertx.core.spi.resolver.ResolverProvider
INFO: Using the default address resolver as the dns resolver could not be loaded
Sep 08, 2023 11:23:09 AM io.netty.util.internal.MacAddressUtil defaultMachineId
WARNING: Failed to find a usable hardware address from the network interfaces; using random bytes: ce:a0:ec:e0:1e:b7:c9:b0
Sep 08, 2023 11:23:09 AM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle

The "Failed to find a usable hardware address" warning is removed by https://github.com/nanovms/nanos/pull/1939.