nanovms / nanos

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

lwan tracking tkt #796

Closed eyberg closed 4 years ago

eyberg commented 5 years ago

i don't see a reason to do anything more w/these than provide stubs - lwan wants them

eyberg@s1:~/lwan/lwan/build/src/bin/lwan$ cat config.json
{
  "Args": ["./lwan", "-c", "/lwan.conf"],
  "Files": ["lwan.conf"]
}
eyberg@s1:~/lwan/lwan/build/src/bin/lwan$ ops run -d -c config.json -p 8080 lwan
1 capset
1 nosyscall capset
1 write
Loading configuration file: /lwan.conf
Could not drop capabilities: Function not implemented (error number 38)
1 direct return: 111, rsp 0x769fc870
1 exit_group
exit status 3
trungkiena6 commented 5 years ago

Hi @francescolavra and @eyberg , I analyzed the root cause in lwan and I found lwan called capset in its API. But we didn't implemented it. So, I set it to syscall_ignore. Now, it is always return true. Could you please review my pull request for this issue?

Thanks Kien

eyberg commented 5 years ago

it gets past the capget calls however the connection doesn't seem to close after an intial request

            4 [lwan worker] direct return: 1072, rsp 0x7028009330
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
            4 [lwan worker] wakeup 4->4 0x00000070a9d21bb7
            4 [lwan worker] run frame 0x0000000100a02400, RIP=0x00000070a9d21bb7
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
            4 [lwan worker] wakeup 4->4 0x00000070a9d21bb7
            4 [lwan worker] run frame 0x0000000100a02400, RIP=0x00000070a9d21bb7
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] time
            4 [lwan worker] direct return: 1563911460, rsp 0x70a31ffcf8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
            4 [lwan worker] wakeup 4->4 0x00000070a9d21bb7
            4 [lwan worker] run frame 0x0000000100a02400, RIP=0x00000070a9d21bb7
            4 [lwan worker] close
            4 [lwan worker] close: fd 12
            4 [lwan worker] direct return: 0, rsp 0x70a31ffce0
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
            4 [lwan worker] wakeup 4->4 0x00000070a9d21bb7
            4 [lwan worker] run frame 0x0000000100a02400, RIP=0x00000070a9d21bb7
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
            4 [lwan worker] wakeup 4->4 0x00000070a9d21bb7
            4 [lwan worker] run frame 0x0000000100a02400, RIP=0x00000070a9d21bb7
            4 [lwan worker] clock_gettime
            4 [lwan worker] clock_gettime: clk_id 6
            4 [lwan worker] direct return: 0, rsp 0x70a31ffcd8
            4 [lwan worker] time
            4 [lwan worker] direct return: 1563911461, rsp 0x70a31ffcf8
            4 [lwan worker] epoll_wait
            4 [lwan worker] sleep
francescolavra commented 5 years ago

The connection does close after a request: if the HTTP client doesn't close the connection right away, then Lwan closes it after around 15 seconds. During those 15 seconds you see the trace messages you posted because Lwan calls epoll_wait() with a 1-second timeout for 15 times, and eventually calls it with an infinite timeout, at which point the trace messages stop. The relevant code in Lwan that picks timeout values to pass to epoll_wait() is at https://github.com/lpereira/lwan/blob/d7dcff4ea828fe267a2381afa560600eefd2f870/src/lib/lwan-thread.c#L401.

There was another issue, though: when you try to download a file from the Lwan web server, the connection gets reset. This is now fixed in the updated PR #889

A couple more notes:

lpereira commented 5 years ago

Lwan will refuse to serve any files that are not world-readable. It's a (weak) security feature. No way to disable this at the moment with only a configuration change.

wjhun commented 4 years ago

What's the latest here? Can we close this?

eyberg commented 4 years ago

yeh - seems to be working for me - i'll create a pkg and close