From dd1523d3edc48d1e255fbe4e4b6e4c538df66918 Mon Sep 17 00:00:00 2001
From: Alexandr Lyapunov <a.lyapunov@corp.mail.ru>
Date: Mon, 13 Jul 2015 17:26:24 +0300
Subject: [PATCH] fixed gh-914 app/snapshot.test.lua crash 1)removed atfork
 xlog resources freeing - they could be corrupted but xlog thread
 2)snapshot.test now use pcall(box.snapshot) for deterministic code flow

---
 src/box/xlog.cc            |  2 --
 test/app/snapshot.test.lua | 15 ++++++---------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/box/xlog.cc b/src/box/xlog.cc
index 2b80411426..d9062acbde 100644
--- a/src/box/xlog.cc
+++ b/src/box/xlog.cc
@@ -646,8 +646,6 @@ xlog_atfork(struct xlog **lptr)
 		 * fclose().
 		 */
 		close(fileno(l->f));
-		fclose(l->f);
-		free(l);
 		*lptr = NULL;
 	}
 }
diff --git a/test/app/snapshot.test.lua b/test/app/snapshot.test.lua
index c98cbf9a16..a2d78590a0 100755
--- a/test/app/snapshot.test.lua
+++ b/test/app/snapshot.test.lua
@@ -5,9 +5,11 @@ fiber = require('fiber')
 --
 -- Check that Tarantool creates ADMIN session for #! script
 --
+continue_snapshoting = true
+
 function noise()
     fiber.name('noise-'..fiber.id())
-    while true do
+    while continue_snapshoting do
         if box.space.test:len() < 300000 then
             local  value = string.rep('a', math.random(255)+1)
             box.space.test:auto_increment{fiber.time64(), value}
@@ -18,7 +20,7 @@ end
 
 function purge()
     fiber.name('purge-'..fiber.id())
-    while true do
+    while continue_snapshoting do
         local min = box.space.test.index.primary:min()
         if min ~= nil then
             box.space.test:delete{min[1]}
@@ -27,18 +29,13 @@ function purge()
     end
 end
 
-continue_snapshoting = true
-
 function snapshot(lsn)
     fiber.name('snapshot')
-    while true do
+    while continue_snapshoting do
         local new_lsn = box.info.server.lsn
         if new_lsn ~= lsn then
             lsn = new_lsn;
-            box.snapshot()
-        end
-        if not continue_snapshoting then
-            break
+            pcall(box.snapshot)
         end
         fiber.sleep(0.001)
     end
-- 
GitLab