← Back to team overview

dx-packages team mailing list archive

[Bug 1288483] [NEW] accounts-daemon does not terminate at computer shutdown

 

Public bug reported:

shutdown while testing a dbus-monitor script to work around a problem in in my java app :)
Seems like your logoff is pretty broken, a simple test java app with a jframe and a shutdown hook (only) always returns non-zero on logoff (and doesn't run the hook) and other gnome programs crash regularly there. Something is rotten in denmark
package i3.main;

import java.awt.EventQueue;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.reflect.InvocationTargetException;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import org.openide.util.Exceptions;

/**
 * Test for shutdown bug workaround
 *
 * @author i30817
 */
public class TEST implements Runnable {

    public void main(String[] blah) {
        try {
            new TEST();
        } catch (InvocationTargetException ex) {
            Exceptions.printStackTrace(ex);
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }

    public TEST() throws InvocationTargetException, IOException {
        //First shutdown hook of the app to be added first after the system/native ones
        Runtime.getRuntime().addShutdownHook(new Thread(new SaveRunnable()));
        EventQueue.invokeLater(this);

        //Note: does not work with the shutdown command line utility
        if ("GNOME".equals(System.getenv("XDG_CURRENT_DESKTOP"))) {
            String pid = getProcessId();
            if (pid == null) {
                return;
            }
            //alive until we kill it, or logoff ope dialog;
            //Doesn't try to run on the real real logoff confirmed event to
            //avoid the issue it is trying to solve.
            String pleaseKillmeSoftly
                    = "( dbus-monitor --profile --session "
                    + "\"type='method_call',interface='org.gnome.SessionManager.EndSessionDialog',member='Open'\" "
                    + "& echo $! >&3 ) 3>pid "//store pid
                    //dbus monitor waits until it is flushed to notice the broken pipe
                    //we definitly dont want this on shutdown! Kill it too.
                    + "| grep -m 1 --line-buffered 'Open\\|Disconnected' "
                    + "; kill -s SIGTERM " + pid + " $(<pid) 2>/dev/null";
            System.out.println(pleaseKillmeSoftly);
            try {
                final Process unixKiller = Runtime.getRuntime().exec(pleaseKillmeSoftly);
                Runtime.getRuntime().addShutdownHook(new Thread() {

                    @Override
                    public void run() {
                        unixKiller.destroy();
                    }

                });
            } catch (IOException ex) {
                //oh well
            }
        }
    }

    private static String getProcessId() {
        final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
        final int index = jvmName.indexOf('@');

        if (index < 1) {
            return System.getProperty("sun.java.launcher.pid");
        }
        return jvmName.substring(0, index);
    }

    public void run() {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.validate();
        frame.setVisible(true);
    }

    private static class SaveRunnable implements Runnable {

        @Override
        public void run() {
            System.out.println("OI");
        }
    }
}

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: accountsservice 0.6.35-0ubuntu7
ProcVersionSignature: Ubuntu 3.13.0-14.34-generic 3.13.5
Uname: Linux 3.13.0-14-generic x86_64
ApportVersion: 2.13.2-0ubuntu5
Architecture: amd64
Date: Thu Mar  6 00:06:28 2014
ExecutablePath: /usr/lib/accountsservice/accounts-daemon
InstallationDate: Installed on 2014-01-17 (47 days ago)
InstallationMedia: Ubuntu-GNOME 14.04 "Trusty Tahr" - Alpha amd64 (20140117)
OmitPids: 1320 5010 5016 5003 4987 5033 5002 4975 5016 5003 4987 5033 5002
ProcCmdline: /usr/lib/accountsservice/accounts-daemon
ProcEnviron:

SourcePackage: accountsservice
Title: accounts-daemon does not terminate at computer shutdown
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: accountsservice (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug shutdown-hang trusty

** Description changed:

  shutdown while testing a dbus-monitor script to work around a problem in in my java app :)
  Seems like your logoff is pretty broken, a simple test java app with a jframe and a shutdown hook (only) always returns non-zero on logoff (and doesn't run the hook) and other gnome programs crash regularly there. Something is rotten in denmark
+ package i3.main;
  
+ import java.awt.EventQueue;
+ import java.io.IOException;
+ import java.lang.management.ManagementFactory;
+ import java.lang.reflect.InvocationTargetException;
+ import javax.swing.JFrame;
+ import javax.swing.WindowConstants;
+ import org.openide.util.Exceptions;
+ 
+ /**
+  * Test for shutdown bug workaround
+  *
+  * @author i30817
+  */
+ public class TEST implements Runnable {
+ 
+     public void main(String[] blah) {
+         try {
+             new TEST();
+         } catch (InvocationTargetException ex) {
+             Exceptions.printStackTrace(ex);
+         } catch (IOException ex) {
+             Exceptions.printStackTrace(ex);
+         }
+     }
+ 
+     public TEST() throws InvocationTargetException, IOException {
+         //First shutdown hook of the app to be added first after the system/native ones
+         Runtime.getRuntime().addShutdownHook(new Thread(new SaveRunnable()));
+         EventQueue.invokeLater(this);
+ 
+         //Note: does not work with the shutdown command line utility
+         if ("GNOME".equals(System.getenv("XDG_CURRENT_DESKTOP"))) {
+             String pid = getProcessId();
+             if (pid == null) {
+                 return;
+             }
              //alive until we kill it, or logoff ope dialog;
              //Doesn't try to run on the real real logoff confirmed event to
              //avoid the issue it is trying to solve.
              String pleaseKillmeSoftly
                      = "( dbus-monitor --profile --session "
                      + "\"type='mc',interface='org.gnome.SessionManager.EndSessionDialog',member='Open'\" "
                      + "& echo $! >&3 ) 3>pid "//store pid
                      //dbus monitor waits until it is flushed to notice the broken pipe
                      //we definitly dont want this on shutdown! Kill it too.
                      + "| grep -m 1 --line-buffered 'Open\\|Disconnected' "
                      + "; kill -s SIGTERM " + pid + " $(<pid) 2>/dev/null";
              System.out.println(pleaseKillmeSoftly);
              try {
                  final Process unixKiller = Runtime.getRuntime().exec(pleaseKillmeSoftly);
                  Runtime.getRuntime().addShutdownHook(new Thread() {
  
                      @Override
                      public void run() {
                          unixKiller.destroy();
                      }
  
                  });
              } catch (IOException ex) {
                  //oh well
              }
+         }
+     }
+ 
+     private static String getProcessId() {
+         final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
+         final int index = jvmName.indexOf('@');
+ 
+         if (index < 1) {
+             return System.getProperty("sun.java.launcher.pid");
+         }
+         return jvmName.substring(0, index);
+     }
+ 
+     public void run() {
+         final JFrame frame = new JFrame();
+         frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+         frame.validate();
+         frame.setVisible(true);
+     }
+ 
+     private static class SaveRunnable implements Runnable {
+ 
+         @Override
+         public void run() {
+             System.out.println("OI");
+         }
+     }
+ }
+ 
  
  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: accountsservice 0.6.35-0ubuntu7
  ProcVersionSignature: Ubuntu 3.13.0-14.34-generic 3.13.5
  Uname: Linux 3.13.0-14-generic x86_64
  ApportVersion: 2.13.2-0ubuntu5
  Architecture: amd64
  Date: Thu Mar  6 00:06:28 2014
  ExecutablePath: /usr/lib/accountsservice/accounts-daemon
  InstallationDate: Installed on 2014-01-17 (47 days ago)
  InstallationMedia: Ubuntu-GNOME 14.04 "Trusty Tahr" - Alpha amd64 (20140117)
  OmitPids: 1320 5010 5016 5003 4987 5033 5002 4975 5016 5003 4987 5033 5002
  ProcCmdline: /usr/lib/accountsservice/accounts-daemon
  ProcEnviron:
-  
+ 
  SourcePackage: accountsservice
  Title: accounts-daemon does not terminate at computer shutdown
  UpgradeStatus: No upgrade log present (probably fresh install)

** Description changed:

  shutdown while testing a dbus-monitor script to work around a problem in in my java app :)
  Seems like your logoff is pretty broken, a simple test java app with a jframe and a shutdown hook (only) always returns non-zero on logoff (and doesn't run the hook) and other gnome programs crash regularly there. Something is rotten in denmark
  package i3.main;
  
  import java.awt.EventQueue;
  import java.io.IOException;
  import java.lang.management.ManagementFactory;
  import java.lang.reflect.InvocationTargetException;
  import javax.swing.JFrame;
  import javax.swing.WindowConstants;
  import org.openide.util.Exceptions;
  
  /**
-  * Test for shutdown bug workaround
-  *
-  * @author i30817
-  */
+  * Test for shutdown bug workaround
+  *
+  * @author i30817
+  */
  public class TEST implements Runnable {
  
-     public void main(String[] blah) {
-         try {
-             new TEST();
-         } catch (InvocationTargetException ex) {
-             Exceptions.printStackTrace(ex);
-         } catch (IOException ex) {
-             Exceptions.printStackTrace(ex);
-         }
-     }
+     public void main(String[] blah) {
+         try {
+             new TEST();
+         } catch (InvocationTargetException ex) {
+             Exceptions.printStackTrace(ex);
+         } catch (IOException ex) {
+             Exceptions.printStackTrace(ex);
+         }
+     }
  
-     public TEST() throws InvocationTargetException, IOException {
-         //First shutdown hook of the app to be added first after the system/native ones
-         Runtime.getRuntime().addShutdownHook(new Thread(new SaveRunnable()));
-         EventQueue.invokeLater(this);
+     public TEST() throws InvocationTargetException, IOException {
+         //First shutdown hook of the app to be added first after the system/native ones
+         Runtime.getRuntime().addShutdownHook(new Thread(new SaveRunnable()));
+         EventQueue.invokeLater(this);
  
-         //Note: does not work with the shutdown command line utility
-         if ("GNOME".equals(System.getenv("XDG_CURRENT_DESKTOP"))) {
-             String pid = getProcessId();
-             if (pid == null) {
-                 return;
-             }
-             //alive until we kill it, or logoff ope dialog;
-             //Doesn't try to run on the real real logoff confirmed event to
-             //avoid the issue it is trying to solve.
-             String pleaseKillmeSoftly
-                     = "( dbus-monitor --profile --session "
-                     + "\"type='mc',interface='org.gnome.SessionManager.EndSessionDialog',member='Open'\" "
-                     + "& echo $! >&3 ) 3>pid "//store pid
-                     //dbus monitor waits until it is flushed to notice the broken pipe
-                     //we definitly dont want this on shutdown! Kill it too.
-                     + "| grep -m 1 --line-buffered 'Open\\|Disconnected' "
-                     + "; kill -s SIGTERM " + pid + " $(<pid) 2>/dev/null";
-             System.out.println(pleaseKillmeSoftly);
-             try {
-                 final Process unixKiller = Runtime.getRuntime().exec(pleaseKillmeSoftly);
-                 Runtime.getRuntime().addShutdownHook(new Thread() {
+         //Note: does not work with the shutdown command line utility
+         if ("GNOME".equals(System.getenv("XDG_CURRENT_DESKTOP"))) {
+             String pid = getProcessId();
+             if (pid == null) {
+                 return;
+             }
+             //alive until we kill it, or logoff ope dialog;
+             //Doesn't try to run on the real real logoff confirmed event to
+             //avoid the issue it is trying to solve.
+             String pleaseKillmeSoftly
+                     = "( dbus-monitor --profile --session "
+                     + "\"type='method_call',interface='org.gnome.SessionManager.EndSessionDialog',member='Open'\" "
+                     + "& echo $! >&3 ) 3>pid "//store pid
+                     //dbus monitor waits until it is flushed to notice the broken pipe
+                     //we definitly dont want this on shutdown! Kill it too.
+                     + "| grep -m 1 --line-buffered 'Open\\|Disconnected' "
+                     + "; kill -s SIGTERM " + pid + " $(<pid) 2>/dev/null";
+             System.out.println(pleaseKillmeSoftly);
+             try {
+                 final Process unixKiller = Runtime.getRuntime().exec(pleaseKillmeSoftly);
+                 Runtime.getRuntime().addShutdownHook(new Thread() {
  
-                     @Override
-                     public void run() {
-                         unixKiller.destroy();
-                     }
+                     @Override
+                     public void run() {
+                         unixKiller.destroy();
+                     }
  
-                 });
-             } catch (IOException ex) {
-                 //oh well
-             }
-         }
-     }
+                 });
+             } catch (IOException ex) {
+                 //oh well
+             }
+         }
+     }
  
-     private static String getProcessId() {
-         final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
-         final int index = jvmName.indexOf('@');
+     private static String getProcessId() {
+         final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
+         final int index = jvmName.indexOf('@');
  
-         if (index < 1) {
-             return System.getProperty("sun.java.launcher.pid");
-         }
-         return jvmName.substring(0, index);
-     }
+         if (index < 1) {
+             return System.getProperty("sun.java.launcher.pid");
+         }
+         return jvmName.substring(0, index);
+     }
  
-     public void run() {
-         final JFrame frame = new JFrame();
-         frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
-         frame.validate();
-         frame.setVisible(true);
-     }
+     public void run() {
+         final JFrame frame = new JFrame();
+         frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+         frame.validate();
+         frame.setVisible(true);
+     }
  
-     private static class SaveRunnable implements Runnable {
+     private static class SaveRunnable implements Runnable {
  
-         @Override
-         public void run() {
-             System.out.println("OI");
-         }
-     }
+         @Override
+         public void run() {
+             System.out.println("OI");
+         }
+     }
  }
- 
  
  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: accountsservice 0.6.35-0ubuntu7
  ProcVersionSignature: Ubuntu 3.13.0-14.34-generic 3.13.5
  Uname: Linux 3.13.0-14-generic x86_64
  ApportVersion: 2.13.2-0ubuntu5
  Architecture: amd64
  Date: Thu Mar  6 00:06:28 2014
  ExecutablePath: /usr/lib/accountsservice/accounts-daemon
  InstallationDate: Installed on 2014-01-17 (47 days ago)
  InstallationMedia: Ubuntu-GNOME 14.04 "Trusty Tahr" - Alpha amd64 (20140117)
  OmitPids: 1320 5010 5016 5003 4987 5033 5002 4975 5016 5003 4987 5033 5002
  ProcCmdline: /usr/lib/accountsservice/accounts-daemon
  ProcEnviron:
  
  SourcePackage: accountsservice
  Title: accounts-daemon does not terminate at computer shutdown
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of DX
Packages, which is subscribed to accountsservice in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/1288483

Title:
  accounts-daemon does not terminate at computer shutdown

Status in “accountsservice” package in Ubuntu:
  New

Bug description:
  shutdown while testing a dbus-monitor script to work around a problem in in my java app :)
  Seems like your logoff is pretty broken, a simple test java app with a jframe and a shutdown hook (only) always returns non-zero on logoff (and doesn't run the hook) and other gnome programs crash regularly there. Something is rotten in denmark
  package i3.main;

  import java.awt.EventQueue;
  import java.io.IOException;
  import java.lang.management.ManagementFactory;
  import java.lang.reflect.InvocationTargetException;
  import javax.swing.JFrame;
  import javax.swing.WindowConstants;
  import org.openide.util.Exceptions;

  /**
   * Test for shutdown bug workaround
   *
   * @author i30817
   */
  public class TEST implements Runnable {

      public void main(String[] blah) {
          try {
              new TEST();
          } catch (InvocationTargetException ex) {
              Exceptions.printStackTrace(ex);
          } catch (IOException ex) {
              Exceptions.printStackTrace(ex);
          }
      }

      public TEST() throws InvocationTargetException, IOException {
          //First shutdown hook of the app to be added first after the system/native ones
          Runtime.getRuntime().addShutdownHook(new Thread(new SaveRunnable()));
          EventQueue.invokeLater(this);

          //Note: does not work with the shutdown command line utility
          if ("GNOME".equals(System.getenv("XDG_CURRENT_DESKTOP"))) {
              String pid = getProcessId();
              if (pid == null) {
                  return;
              }
              //alive until we kill it, or logoff ope dialog;
              //Doesn't try to run on the real real logoff confirmed event to
              //avoid the issue it is trying to solve.
              String pleaseKillmeSoftly
                      = "( dbus-monitor --profile --session "
                      + "\"type='method_call',interface='org.gnome.SessionManager.EndSessionDialog',member='Open'\" "
                      + "& echo $! >&3 ) 3>pid "//store pid
                      //dbus monitor waits until it is flushed to notice the broken pipe
                      //we definitly dont want this on shutdown! Kill it too.
                      + "| grep -m 1 --line-buffered 'Open\\|Disconnected' "
                      + "; kill -s SIGTERM " + pid + " $(<pid) 2>/dev/null";
              System.out.println(pleaseKillmeSoftly);
              try {
                  final Process unixKiller = Runtime.getRuntime().exec(pleaseKillmeSoftly);
                  Runtime.getRuntime().addShutdownHook(new Thread() {

                      @Override
                      public void run() {
                          unixKiller.destroy();
                      }

                  });
              } catch (IOException ex) {
                  //oh well
              }
          }
      }

      private static String getProcessId() {
          final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
          final int index = jvmName.indexOf('@');

          if (index < 1) {
              return System.getProperty("sun.java.launcher.pid");
          }
          return jvmName.substring(0, index);
      }

      public void run() {
          final JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          frame.validate();
          frame.setVisible(true);
      }

      private static class SaveRunnable implements Runnable {

          @Override
          public void run() {
              System.out.println("OI");
          }
      }
  }

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: accountsservice 0.6.35-0ubuntu7
  ProcVersionSignature: Ubuntu 3.13.0-14.34-generic 3.13.5
  Uname: Linux 3.13.0-14-generic x86_64
  ApportVersion: 2.13.2-0ubuntu5
  Architecture: amd64
  Date: Thu Mar  6 00:06:28 2014
  ExecutablePath: /usr/lib/accountsservice/accounts-daemon
  InstallationDate: Installed on 2014-01-17 (47 days ago)
  InstallationMedia: Ubuntu-GNOME 14.04 "Trusty Tahr" - Alpha amd64 (20140117)
  OmitPids: 1320 5010 5016 5003 4987 5033 5002 4975 5016 5003 4987 5033 5002
  ProcCmdline: /usr/lib/accountsservice/accounts-daemon
  ProcEnviron:

  SourcePackage: accountsservice
  Title: accounts-daemon does not terminate at computer shutdown
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/1288483/+subscriptions


Follow ups

References