httpx icon indicating copy to clipboard operation
httpx copied to clipboard

`EPOLLHUP` event causes `AssertionDefect` to be thrown

Open shunf4 opened this issue 2 years ago • 0 comments

https://github.com/xflywind/httpx/blob/7e8ca92efe921fbe2aa363ffafe3c443cc9b73fa/src/httpx.nim#L443-L444

When events[i].events contains neither Read nor Write, an AssertionDefect is thrown.

However, as per code lines in ioselectors:

https://github.com/xflywind/ioselectors/blob/6fcdbf3fddeb239885cd8bce15a0ab63c00647c0/src/ioselectors/ioselectors_wepoll.nim#L264-L270

only EPOLLOUT and EPOLLIN will be recorded in rkey.events. There is still the possibility for events like EPOLLHUP to take place, and cause rkey.events to be empty, and thus AssertionDefect is thrown in httpx:

...(25) ...
C:\Users\shunf4\.nimble\pkgs\prologue-0.4.4\prologue\core\application.nim(534) run
C:\Users\shunf4\.nimble\pkgs\prologue-0.4.4\prologue\core\beast\server.nim(31) serve
C:\Users\shunf4\.nimble\pkgs\httpx-0.2.4\httpx.nim(...) run
C:\Users\shunf4\.nimble\pkgs\httpx-0.2.4\httpx.nim(...) eventLoop
C:\Users\shunf4\.nimble\pkgs\httpx-0.2.4\httpx.nim(...) processEvents
C:\tools\Nim\nim-1.4.6\lib\system\assertions.nim(30) failedAssertImpl
C:\tools\Nim\nim-1.4.6\lib\system\assertions.nim(23) raiseAssert
C:\tools\Nim\nim-1.4.6\lib\system\fatal.nim(49) sysFatal
Error: unhandled exception: C:\Users\shunf4\.nimble\pkgs\httpx-0.2.4\httpx.nim(..., 16) `false`  [AssertionDefect]

shunf4 avatar Aug 24 '21 14:08 shunf4