I am using SVNKit 1.7.4-v1. When SVNKit lib runs in ubuntu, I found the
keyring functions hangs in the daemon thread.

NOTE: wincrypt for Windows and keychain for MacOS are not suffered from this
problem.

The main functions I called are:

try {
        boolean isSaved = SVNGnomeKeyring.setPassword("test realm", "test user
name", "test password", false /* nonInteractive */, null /*
keyringPasswordProvider */);
        System.out.println("setPassword = " + isSaved);

        String savedPasswd = SVNGnomeKeyring.getPassword("test realm", "test 
user
name", false /* nonInteractive */, null /* keyringPasswordProvider */);
        System.out.println("getPassword = " + savedPasswd);
} catch (SVNException e) {
        e.printStackTrace();
}

The above code works fine in the command line. But when it is running in the
daemon thread that is NOT the UI thread (IMPORTANT), program always hangs in
native code in SVNMethodCallLogger.

Thread thread = new Thread(new Runnable() {

@Override
public void run() {

        try {
                boolean isSaved = SVNGnomeKeyring.setPassword("test realm", 
"test user
name", "test password", false /* nonInteractive */, null /*
keyringPasswordProvider */);
                System.out.println("setPassword = " + isSaved);

                String savedPasswd = SVNGnomeKeyring.getPassword("test realm", 
"test user
name", false /* nonInteractive */, null /* keyringPasswordProvider */);
                System.out.println("getPassword = " + savedPasswd);
} catch (SVNException e) {
                e.printStackTrace();
}
}});

Shell shell = new Shell();
shell.open();
thread.start();

while (!shell.isDisposed()) {
        try {
                if (!shell.getDisplay().readAndDispatch()) {
                        shell.getDisplay().sleep();
                }
        } catch (Throwable e) {
                if (e instanceof ThreadDeath) {
                        // Don't catch ThreadDeath as this is a normal
                        // occurrence when the thread dies
                        throw (ThreadDeath) e;
                }
        }
}
                
try {
        thread.join();
} catch (InterruptedException e) {
        e.printStackTrace();
}

When program hangs in the daemon thread, the UI also hangs. So I believe the
problem is relative to the message loop. I do not have the source code of
the native code, so I cannot trace the problem deeper.

Any suggestions?
-- 
View this message in context: 
http://old.nabble.com/Gnome-Keyring-Hangs-When-Current-Thread-Is-Not-the-UI-Thread-tp33979813p33979813.html
Sent from the SVNKit - Users mailing list archive at Nabble.com.


Reply via email to