uNetworking / uSockets

Miniscule cross-platform eventing, networking & crypto for async applications
Apache License 2.0
1.29k stars 268 forks source link

1 curl https request strace #34

Closed ddosoff closed 5 years ago

ddosoff commented 5 years ago

Hello Alex,

I tried to do 1 curl requst to SSLApp from examples/HelloWorlds.js:

$ curl -k https://localhost:9001/

It seems something wrong in the event loop request handling logic:

1549719277.970468 accept4(20, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = 21
1549719277.970569 epoll_ctl(3, EPOLL_CTL_ADD, 21, {EPOLLIN, {u32=4294967295, u64=1791001362431}}) = 0
1549719277.970664 epoll_ctl(3, EPOLL_CTL_DEL, 21, 0x7fffac471a20) = 0
1549719277.970690 ioctl(21, FIONBIO, [1]) = 0
1549719277.970713 epoll_ctl(3, EPOLL_CTL_DEL, 21, 0x7fffac471a40) = -1 ENOENT (No such file or directory)
1549719277.970737 setsockopt(21, SOL_TCP, TCP_NODELAY, [1], 4) = 0
1549719277.970776 accept4(20, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = -1 EAGAIN (Resource temporarily unavailable)
1549719277.970813 epoll_ctl(3, EPOLL_CTL_ADD, 21, {EPOLLIN, {u32=21, u64=563242011197461}}) = 0
1549719277.970837 epoll_pwait(3, [{EPOLLIN, {u32=21, u64=563242011197461}}], 1024, 950, NULL, 8) = 1
1549719277.975440 recvfrom(21, "\26\3\1\0\317\1\0\0\313\3\3X\2776\256\234\356\22d\377t)\t9\\\352\216\3E\353Q\16"..., 524288, 0, NULL, NULL) = 212
...

After accept4 file descriptor 21 we do EPOLL_CTL_ADD then EPOLL_CTL_DEL twice, then accept4 again.

Please correct this behavior, this is not only waste of time. Some bigger problem inside.

ddosoff commented 5 years ago

In the end double DEL too:

1549719277.977965 recvfrom(21, "\25\3\3\0\32\370\207{\"\320\34\225u\340\3622\2672\2105v\310\5\317\250\355%2;\325\277", 524288, 0, NULL, NULL) = 31
1549719277.978002 epoll_ctl(3, EPOLL_CTL_DEL, 21, 0x7fffac471a50) = 0
1549719277.978024 epoll_ctl(3, EPOLL_CTL_DEL, 21, 0x7fffac471a50) = -1 ENOENT (No such file or directory)
1549719277.978046 close(21)             = 0
ghost commented 5 years ago

Maybe you shouldn't be so assertive about low level behavior when you're basically just guessing. This behavior is polling based, isolated to one single small file - and only affects libuv. So, let's debug and see if this is libuv behavior? Hmmmm... yes! It is. Closing this report as invalid. Two strikes now, do more research before yelling at everything you see.

ddosoff commented 5 years ago

Why uWebSockets.js use libuv?

rnbrady commented 4 years ago

@ddosoff may I ask which command you used to obtain such logs?

ghost commented 4 years ago

Strace