MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Kevin Lewis Date:June 4 2009 1:03pm
Subject:bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2720)
View as plain text  
#At file:///C:/Work/bzr/Merge/mysql-6.0-falcon-team/ based on revid:kevin.lewis@stripped

 2720 Kevin Lewis	2009-06-04 [merge]
      Merge

    modified:
      libservices/thd_alloc_service.c
      mysql-test/lib/My/SafeProcess/safe_process_win.cc
       2718.1.1 John H. Embretsen	2009-06-04 [merge]
                Merge mysql-6.0-falcon --> mysql-6.0-falcon-team.
                Includes fix for MTR/Pushbuild/Windows bug (44775).

        modified:
          libservices/thd_alloc_service.c
          mysql-test/lib/My/SafeProcess/safe_process_win.cc
       2707.1.4 John H. Embretsen	2009-06-03 [merge]
                Cherrypick (merge) fix for bug 44775 (MTR fails to bootstrap mysqld on Windows in Pushbuild 2)
                from mysql-6.0-mtr to mysql-6.0-falcon.

        modified:
          mysql-test/lib/My/SafeProcess/safe_process_win.cc
          2651.27.1 Vladislav Vaintroub	2009-05-15 [merge]
                    merge fix for 44775

            modified:
              mysql-test/lib/My/SafeProcess/safe_process_win.cc
         2497.899.2 Vladislav Vaintroub	2009-05-15 [merge]
                    merge

            modified:
              mysql-test/lib/mtr_cases.pm
              mysql-test/mysql-test-run.pl
         2497.899.1 Vladislav Vaintroub	2009-05-14
                    Bug #44775 MTR fails to bootstrap mysqld on Windows in Pushbuild 2.
                    
                    Suspected reason for the failure is that safe_process.exe already runs in a job that does not allow breakaways. 
                    The fix is to use a fallback -  make newly created process the root of the new process group. This allows to kill process together with descendants via GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, pid)

            modified:
              mysql-test/lib/My/SafeProcess/safe_process_win.cc
       2707.1.3 Vladislav Vaintroub	2009-05-29
                Fix typo (breaks windows build)

        modified:
          libservices/thd_alloc_service.c
       2707.1.2 John H. Embretsen	2009-05-20
                Fixed .bzr-mysql/default.conf after merging falcon-team --> falcon.

        modified:
          .bzr-mysql/default.conf
=== modified file 'libservices/thd_alloc_service.c'
--- a/libservices/thd_alloc_service.c	2009-05-06 18:17:49 +0000
+++ b/libservices/thd_alloc_service.c	2009-05-29 19:05:24 +0000
@@ -14,4 +14,4 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <service_versions.h>
-SERVICE_VERSION thd_alloc_servicee= (void*)VERSION_thd_alloc;
+SERVICE_VERSION thd_alloc_service= (void*)VERSION_thd_alloc;

=== modified file 'mysql-test/lib/My/SafeProcess/safe_process_win.cc'
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-02-09 18:24:48 +0000
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc	2009-05-14 19:56:53 +0000
@@ -259,22 +259,37 @@ int main(int argc, const char** argv )
     the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag, making sure it will be
     terminated when the last handle to it is closed(which is owned by
     this process).
+
+    If breakaway from job fails on some reason, fallback is to create a
+    new process group. Process groups also allow to kill process and its 
+    descedants, subject to some restrictions (processes have to run within
+    the same console,and must not ignore CTRL_BREAK)
   */
-  if (CreateProcess(NULL, (LPSTR)child_args,
+  DWORD create_flags[]= {CREATE_BREAKAWAY_FROM_JOB, CREATE_NEW_PROCESS_GROUP, 0};
+  BOOL process_created= FALSE;
+  BOOL jobobject_assigned= FALSE;
+
+  for (int i=0; i < sizeof(create_flags)/sizeof(create_flags[0]); i++)
+  { 
+    process_created= CreateProcess(NULL, (LPSTR)child_args,
                     NULL,
                     NULL,
                     TRUE, /* inherit handles */
-                    CREATE_SUSPENDED | CREATE_BREAKAWAY_FROM_JOB,
+                    CREATE_SUSPENDED | create_flags[i],
                     NULL,
                     NULL,
                     &si,
-                    &process_info) == 0)
-    die("CreateProcess failed");
+                    &process_info);
+    if (process_created)
+    {
+     jobobject_assigned= AssignProcessToJobObject(job_handle, process_info.hProcess);
+     break;
+    }
+  }
 
-  if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0)
+  if (!process_created)
   {
-    TerminateProcess(process_info.hProcess, 200);
-    die("AssignProcessToJobObject failed");
+    die("CreateProcess failed");
   }
   ResumeThread(process_info.hThread);
   CloseHandle(process_info.hThread);
@@ -312,6 +327,13 @@ int main(int argc, const char** argv )
     message("TerminateJobObject failed");
   CloseHandle(job_handle);
   message("Job terminated and closed");
+
+  if (!jobobject_assigned)
+  {
+    GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, process_info.dwProcessId);
+    TerminateProcess(process_info.hProcess, 202);
+  }
+
   if (wait_res != WAIT_OBJECT_0 + CHILD)
   {
     /* The child has not yet returned, wait for it */


Attachment: [text/bzr-bundle] bzr/kevin.lewis@sun.com-20090604130219-jpcq1a64dfpo4yto.bundle
Thread
bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2720)Kevin Lewis4 Jun