Skip to content

DownloadHandler disconnects from UI on Firefox #21587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #7524
HerbertsVaadin opened this issue Jun 2, 2025 · 4 comments
Open
Tracked by #7524

DownloadHandler disconnects from UI on Firefox #21587

HerbertsVaadin opened this issue Jun 2, 2025 · 4 comments

Comments

@HerbertsVaadin
Copy link
Contributor

Description

Seems like there's a connection issue on Firefox, causing delay of notifications (at some point they still appear) and temporary UI disconnect to occur (causing "Online" text to appear in the loader.
Occurs consistently after a couple of downloads.
I have not had any issues with it on Chrome.

Logged error:

2025-06-02T13:10:50.800+03:00 ERROR 53611 --- [phere-Shared-43] c.v.f.s.c.PushAtmosphereHandler          : Exception in push connection

java.io.IOException: Connection remotely closed for 7d9d4774-99c6-4995-bd0e-53d1e30d8a14
	at org.atmosphere.websocket.WebSocket.write(WebSocket.java:237) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.websocket.WebSocket.write(WebSocket.java:227) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.websocket.WebSocket.write(WebSocket.java:48) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.cpr.AtmosphereResponseImpl$Stream.write(AtmosphereResponseImpl.java:955) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:154) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at com.vaadin.flow.server.communication.PushAtmosphereHandler.onStateChange(PushAtmosphereHandler.java:54) ~[flow-server-24.8.0.beta2.jar:24.8.0.beta2]
	at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1036) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1056) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:870) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]
	at org.atmosphere.cpr.DefaultBroadcaster$2.run(DefaultBroadcaster.java:477) ~[atmosphere-runtime-3.0.5.slf4jvaadin1.jar:3.0.5.slf4jvaadin1]

Expected outcome

I would expect it to work like on Chrome.

Minimal reproducible example

private Anchor createDownloadLink() {
    return new Anchor(e -> {
        e.setFileName("myfile.txt");
        e.setContentType("text/plain");
        try {
            e.getOutputStream().write("AAAAAAAAAAAAAAAAAAAAAAAAA".getBytes(StandardCharsets.UTF_8));
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        e.getUI().access(() -> Notification.show("\"%s\" downloaded".formatted("myfile.txt")));
    }, "Download here");
}

Steps to reproduce

  1. Use the code snipped
  2. Click the download link.

Environment

Vaadin version(s): 24.8.0.beta2
OS: Linux Mint
Firefox: 139.0.0

Browsers

Firefox

@knoobie
Copy link
Contributor

knoobie commented Jun 2, 2025

@mshabarov looks like your issue still persists (#21487)

@sissbruecker sissbruecker transferred this issue from vaadin/flow-components Jun 2, 2025
@mshabarov
Copy link
Contributor

mshabarov commented Jun 2, 2025

Yes, this is the same issue.
The workaround for cases, when download a file is acceptable, is to add download attribute to the Anchor:

var anchor = new Anchor(event -> {...});
anchor.setDownload(true);

Ideally the problem with WS connection should be fixed.

@mshabarov
Copy link
Contributor

It should now have the attribute by default via #21649.

@caalador
Copy link
Contributor

caalador commented Jun 9, 2025

For the WS connection issue there is an open bug on firefox that may be resolved at some point https://bugzilla.mozilla.org/show_bug.cgi?id=896666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Normal Priority (P2)
Status: 🟢Ready to Go
Development

No branches or pull requests

4 participants