@Override
  public void run() {
    try {
      Log.i(TAG, "Starting openvpn");
      startOpenVPNThreadArgs(mArgv, mProcessEnv);
      Log.i(TAG, "Giving up");
    } catch (Exception e) {
      VpnStatus.logException("Starting OpenVPN Thread", e);
      Log.e(TAG, "OpenVPNThread Got " + e.toString());
    } finally {
      int exitvalue = 0;
      try {
        if (mProcess != null) exitvalue = mProcess.waitFor();
      } catch (IllegalThreadStateException ite) {
        VpnStatus.logError("Illegal Thread state: " + ite.getLocalizedMessage());
      } catch (InterruptedException ie) {
        VpnStatus.logError("InterruptedException: " + ie.getLocalizedMessage());
      }
      if (exitvalue != 0) {
        VpnStatus.logError("Process exited with exit value " + exitvalue);
        if (mBrokenPie) {
          /* This will probably fail since the NoPIE binary is probably not written */
          String[] noPieArgv = VPNLaunchHelper.replacePieWithNoPie(mArgv);

          // We are already noPIE, nothing to gain
          if (!noPieArgv.equals(mArgv)) {
            mArgv = noPieArgv;
            VpnStatus.logInfo("PIE Version could not be executed. Trying no PIE version");
            run();
            return;
          }
        }
      }

      VpnStatus.updateStateString(
          "NOPROCESS",
          "No process running.",
          R.string.state_noprocess,
          ConnectionStatus.LEVEL_NOTCONNECTED);
      if (mDumpPath != null) {
        try {
          BufferedWriter logout = new BufferedWriter(new FileWriter(mDumpPath + ".log"));
          SimpleDateFormat timeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.GERMAN);
          for (LogItem li : VpnStatus.getlogbuffer()) {
            String time = timeformat.format(new Date(li.getLogtime()));
            logout.write(time + " " + li.getString(mService) + "\n");
          }
          logout.close();
          VpnStatus.logError(R.string.minidump_generated);
        } catch (IOException e) {
          VpnStatus.logError("Writing minidump log: " + e.getLocalizedMessage());
        }
      }

      mService.processDied();
      Log.i(TAG, "Exiting");
    }
  }