Closed Bug 1809332 Opened 1 year ago Closed 6 months ago

Server-sent event retries are broken in Firefox

Categories

(Core :: DOM: Networking, defect, P2)

Firefox 108
defect

Tracking

()

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: evanw, Assigned: acreskey)

References

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

Attachments

(2 files)

Attached video bug-demo.mov

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Firefox/108.0

Steps to reproduce:

If a page uses EventSource and the server is ever restarted, Firefox stops trying to reconnect. I assume this means that Firefox's implementation is broken since this defeats the whole purpose of having retry in the first place. See the attached screen recording for an example of Firefox's broken behavior next to Chrome and Safari, which both handle this correctly.

This can be reproduced using the following node server code:

require('http').createServer((req, res) => {
  if (req.url === '/') {
    res.writeHead(200, { 'Content-Type': 'text/html' })
    res.write(`
      <!DOCTYPE html>
      <script>
        let counter = 0
        const stream = new EventSource('/events')
        stream.onopen = () => console.log('open', ++counter)
      </script>
    `)
  } else if (req.url === '/events') {
    res.writeHead(200, { 'Content-Type': 'text/event-stream' })
    res.write('retry: 500\n')
  }
  res.end()
}).listen(8000)

Steps to reproduce (see also the attached screen recording):

  1. Run that server from the terminal
  2. Load the page in Firefox and use the console to observe retries happening
  3. Use Ctrl+C to stop the server, then restart the server

Actual results:

Firefox stops trying to reconnect once the server is restarted.

Expected results:

Firefox should continue trying to reconnect even though the server was restarted.

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

Component: Untriaged → DOM: Events
Product: Firefox → Core

Duplicate of bug 1706003?

Component: DOM: Events → DOM: Networking

That sounds like it's for this issue and it was closed four days ago. However, it doesn't appear to have been fixed. I'm testing on Nightly 2023-01-09 (i.e. from today) and Firefox still fails to retry. So it still seems to be broken?

Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-review]
Flags: needinfo?(smayya)

I can still reproduce this issue in latest Nightly. Moving this to priority next.

Flags: needinfo?(smayya)
Whiteboard: [necko-triaged][necko-priority-review] → [necko-triaged][necko-priority-next]
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]
Assignee: nobody → acreskey
See Also: → 1808511
Attachment #9357065 - Attachment description: WIP: Bug 1809332 - Server-sent event retries are broken in Firefox → Bug 1809332 - Server-sent event retries are broken in Firefox r=#necko-reviewers
Pushed by acreskey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9211b558f680
Server-sent event retries are broken in Firefox r=necko-reviewers,jesup
Status: UNCONFIRMED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
See Also: → 1872413
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: