Closed Bug 1807474 Opened 2 years ago Closed 2 years ago

Enabling network.http.http2.websockets breaks wss to mosquitto broker

Categories

(Core :: Networking, defect)

Firefox 110
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: drJeckyll, Unassigned)

References

(Regression)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0

Steps to reproduce:

After updating firefox to 110.0a1 (2022-12-23) (64-bit) it breaks wss connection to mosquitto with:
"The connection to wss://xxx:1888/mqtt was interrupted while the page was loading."

Actual results:

Using mozregression leads me to this: https://bugzilla.mozilla.org/show_bug.cgi?id=1774572
Disabling network.http.http2.websockets fixes issue.

The Bugbug bot thinks this bug should belong to the 'Core::Networking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking
Product: Firefox → Core

With network.http.http2.websockets enabled, but disabled http2 in libwebsockets-4.3.2 which mosquitto-2.0.15 uses resolve issue too.

So there is something wrong with FF and mosquitto with libwebsockets. No such issue exists with Chrome 108.0.5359.98, but I don't idea if it uses http2 or not.

Regressed by: 1774572

:kershaw, since you are the author of the regressor, bug 1774572, could you take a look? Also, could you set the severity field?

For more information, please visit auto_nag documentation.

Flags: needinfo?(kershaw)

Hi Reporter,

Could you provide me a public link for reproducing this at my side?
Or could you try to record two http logs ? One with network.http.http2.websockets being true and the other one not.

Thanks.

Flags: needinfo?(kershaw) → needinfo?(drJeckyll)

(In reply to Kershaw Chang [:kershaw] from comment #4)

Hi Reporter,

Could you provide me a public link for reproducing this at my side?
Or could you try to record two http logs ? One with network.http.http2.websockets being true and the other one not.

Thanks.

Well ... I recompiled libwebsockets with http2 enabled, so let's try:
Set network.http.http2.websockets to true, then visit https://automatico.jeckyll.net/ - click login and enter test for username and password.
In console every couple of seconds I start to see "The connection to wss://automatico.jeckyll.net:1888/mqtt was interrupted while the page was loading.".
Now if I just set network.http.http2.websockets to false I can see other colored squares which if what must happen after login success. Set network.http.http2.websockets to true, refresh web page and ... error is back again.

Flags: needinfo?(drJeckyll)

Thanks for the link. I can reproduce this locally.
However, I can only tell that the Http/2 stream was reset by the server side.

[Parent 42530: Socket Thread]: V/nsHttp Http2Session::LogIO 13728d700 stream=0 id=0x0 [Reading Frame Header]
[Parent 42530: Socket Thread]: V/nsHttp 00000000: 00 00 04 03 00 00 00 00 0F 
[Parent 42530: Socket Thread]: I/nsHttp Http2Session::WriteSegments[13728d700::18] Frame Header Read type 3 data len 4 flags 0 id 0xF
[Parent 42530: Socket Thread]: I/nsHttp Http2Session::ChangeDownstreamState() 13728d700 from 1 to 2
[Parent 42530: Socket Thread]: V/nsHttp Http2Session::LogIO 13728d700 stream=0 id=0x0 [Reading Control Frame]
[Parent 42530: Socket Thread]: V/nsHttp 00000000: 00 00 00 00 
[Parent 42530: Socket Thread]: I/nsHttp Http2Session::RecvRstStream 13728d700 RST_STREAM Reason Code 0 ID f

Do you probably have an idea why the server reset the stream?

Flags: needinfo?(drJeckyll)

No idea. Only thing that change is http2. And it's not mosquito, but libwebsocket.
This is gentoo linux and only thing i change is set out remove http2 use flag. Then recompile libwebsocket and restart mosquito.

Flags: needinfo?(drJeckyll)

(In reply to drJeckyll from comment #7)

No idea. Only thing that change is http2. And it's not mosquito, but libwebsocket.
This is gentoo linux and only thing i change is set out remove http2 use flag. Then recompile libwebsocket and restart mosquito.

But the Wireshark capture still shows that the server hello packet support h2 protocol and the Http/2 settings frame also supports Extended Connect. So, FIrefox still tries to drive websocket connection over Http/2.

Compared to the behavior with Chrome, I've seen that Chrome tried to connect to automatico.jeckyll.net:1888 with Http/1.1, not Http/2. My local Wireshark capture shows that the server hello packet contains no h2 alpn.
I am not sure why there is such a difference between Firefox and Chrome, but it seems to me that Firefox does nothing wrong.

Could you double check at your side and make sure there is no mis-configuration?
Thanks.

Flags: needinfo?(drJeckyll)

I'm not aware of any configuration in mosquitto about http2.

For me it's not big deal, since I know how to overcome that issue. I will just set -http2 use flag and recompile libwebsockets. If FF is OK that's all from me.

btw I found this: https://github.com/eclipse/mosquitto/issues/1211

It's seems there something in mosquitto/libwebsockets that's need to be done and workaround for now is just the same - disable http2 in libwebsockets.

(In reply to drJeckyll from comment #9)

I'm not aware of any configuration in mosquitto about http2.

For me it's not big deal, since I know how to overcome that issue. I will just set -http2 use flag and recompile libwebsockets. If FF is OK that's all from me.

btw I found this: https://github.com/eclipse/mosquitto/issues/1211

It's seems there something in mosquitto/libwebsockets that's need to be done and workaround for now is just the same - disable http2 in libwebsockets.

Thanks for this information. I assume this is a server side issue, so I'll close this bug.
FWIW, this test site (https://libwebsockets.org/testserver/) does show that libwebsockets works with Firefox.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(drJeckyll)
Resolution: --- → WORKSFORME

According to this comment: https://github.com/eclipse/mosquitto/issues/1211#issuecomment-757052775

"@jonjonarnearne libwebsockets on test.mosquitto.org isn't compiled with http2 support, so if it's advertising it as available, that was a bug in libwebsockets. I use firefox all the time, and don't have a problem connecting to https://test.mosquitto.org/sys/ssl.html , for example - I haven't modified about:config."

If this is still the case I don't know.

P.S. I disabled too http2 and with network.http.http2.websockets my web is working too like I said. For me that's enough.

See Also: → 1815545
You need to log in before you can comment on or make changes to this bug.