Repository navigation
Description
I'm hitting a weird issue where the poll function in http2 stream get_next_chunk() returns nil.
Lines 1237 to 1253 in ee3cf4b
| function stream_methods:get_next_chunk(timeout) | |
| local deadline = timeout and (monotime()+timeout) | |
| while self.chunk_fifo:length() == 0 do | |
| if self.state == "closed" or self.state == "half closed (remote)" then | |
| return nil, self.rst_stream_error | |
| end | |
| local which = cqueues.poll(self.chunk_cond, self.connection, timeout) | |
| if which == self.connection then | |
| local ok, err, errno = self.connection:step(0) | |
| if not ok then | |
| return nil, err, errno | |
| end | |
| elseif which == timeout then | |
| return nil, ce.strerror(ce.ETIMEDOUT), ce.ETIMEDOUT | |
| end | |
| timeout = deadline and (deadline-monotime()) | |
| end |
I'm not sure if it's a cqueues bug (potentially caused by my own code) or an expected behavior, but that cause some unexpected behavior in lua-http.
In my case, timeout is nil, which causes the function to exit with a timeout error instead of looping again.
This in turn makes each_chunk exit early, dropping the connection.
I haven´t found minimal example as it's a bit random. It seems to happens when another stream send a big payload.
Performing a nil-check for timeout before comparing it to which does fix the issue so this might be an easy fix, but since I'm not sure if that's an expected behavior, I don't know if this would be the correct way to deal with that issue.
It might be related to #239, but I'm not 100% sure since I'm using http2 over a unix socket
Activity