nchan icon indicating copy to clipboard operation
nchan copied to clipboard

EventSource is not functioning when using http2

Open Peter-Sh opened this issue 4 years ago • 4 comments

Subscriber connections to EventSource are unexpectedly closed when http2 protocol is used.

Nginx logs

2020/06/13 10:07:48 [error] 6#6: *1 output on closed stream, client: 172.17.0.1, server: localhost, request: "GET /subscribe/ HTTP/2.0", host: "localhost:3006"
172.17.0.1 - - [13/Jun/2020:10:07:48 +0000] "GET /subscribe/ HTTP/2.0" 400 0 "-" "curl/7.52.1" "-"

I've build docker environment for reproducing this behaviour and wrote detailed description here: https://github.com/Peter-Sh/nchan-eventsource-http2-issue

Peter-Sh avatar Jun 13 '20 10:06 Peter-Sh

Thanks for the detailed report, I'm looking into this.

slact avatar Jun 14 '20 01:06 slact

Hi, just a word to say I have no problem with HTTP2. My subscribers successfully receive server-sent events (nchan 1.2.7).

jallaix avatar Aug 03 '20 18:08 jallaix

I have the same issue. Both with nginx 1.18 and 1.19.

It also sometimes logs MEMSTORE:01: tried adding WAITING chanhead 000055EB98902400 general/broadcast to chanhead_gc. why?

phiresky avatar Mar 29 '21 20:03 phiresky

More info:

The server responds with a 204 No Content response, but a 400 response is logged.

With nginx 1.16.1 it is also broken. With nginx 1.14.2 it works. So I guess this is a regression. I read somewhere that nchan uses 204 responses to make nginx keep the connection alive. Maybe they changed how this works?

phiresky avatar Mar 29 '21 20:03 phiresky