Skip to content
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

OpenWebstart sometimes get stuck on certificate selection screen #594

Open
greeneHippo opened this issue Jul 4, 2024 · 3 comments
Open

Comments

@greeneHippo
Copy link

I started using OpenWebStart to execute my JNLP files. I notice that after starting the application, the screen (in which you select your certificate) sometimes gets stuck. Just as in #414 I need to close the process via the task manager (I use Windows 11).

In the logs I see the following stacktrace while running with Java 17 and Java 21:

[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Event posted on wrong app context : java.awt.event.WindowEvent[WINDOW_CLOSED,opposite=null,oldState=0,newState=0] on dialog0
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/sun.awt.SunToolkit.postEvent(SunToolkit.java:468)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.SequencedEvent.dispose(SequencedEvent.java:300)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.SequencedEvent.dispatch(SequencedEvent.java:209)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[ERROR][java.base/sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:234)] 	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

After a reinstall of OpenWebStart, or sometimes after cleaning the cache, the error is gone and everything is OK. It almost feels to me that there is some kind of race condition that makes it sometimes happen, and sometimes not.

Any idea what might cause it? If you need more information to analyse the issue, let me know!

@merkisoft
Copy link

merkisoft commented Nov 21, 2024

i have a user with the same issue.
i suspect that multiple threads (AWT and background) are accessing various urls all of which have cert issues (zscaler TLS termination and reissuing of certs) which causes this.

https://github.com/AdoptOpenJDK/IcedTea-Web/blob/d8414248348bc2b08cb5f97926decaa491a0dfa8/core/src/main/java/net/adoptopenjdk/icedteaweb/client/parts/dialogs/security/SecurityDialogs.java#L305

if the fake dialog kicks in at the wrong moment, then it's probably game over.

i don't have a test to reproduce and the link above is actually in the AdoptOpenJDK/IcedTea-Web project

@merkisoft
Copy link

merkisoft commented Nov 25, 2024

I was able to reproduce this with a self-issued certificate on localhost.

the problem exists when doing a backend call in a SwingUtilities.invokeLater together with a background thread backend call to the server with a broken certificate.

the certificate dialog and the UI are completely frozen.

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.InputStream;
import java.net.URL;

public class CertTest {
    private static Dialog initFrame;

    public static void main(String[] args) {
        initFrame = new Dialog(new Frame(), "Bitte warten ...");
        initFrame.setLayout(new BoxLayout(initFrame, BoxLayout.Y_AXIS));
        initFrame.setLocation(200, 300);
        initFrame.setResizable(false);
        initFrame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        initFrame.show();

        SwingUtilities.invokeLater(() -> {
            call();
        });

        call();
    }

    private static void call() {
        try {
            addLog(Thread.currentThread().getName() + " call");

            InputStream inputStream = new URL("https://localhost/do.reload").openStream();
            inputStream.read();

            addLog(Thread.currentThread().getName() + " ok");

        } catch (Exception e) {
            addLog(Thread.currentThread().getName() + " " + e);
        }
    }

    private static void addLog(String s) {
        final Label label = new Label(s);
        initFrame.add(label);
        initFrame.pack();
    }
}

@merkisoft
Copy link

added issue in dependency repo: AdoptOpenJDK/IcedTea-Web#962

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants