Comment 1 for bug 727174

Revision history for this message
Yuriy Vostrikov (vostrikov) wrote : Re: [Bug 727174] [NEW] tarantool_silverbox crashes saving snapshot

Yuriy Vostrikov <email address hidden> writes:

> Public bug reported:
>
> It crashes then signaled to snapshot via SIGUSR1. Please fix.

diff --git a/core/tarantool.c b/core/tarantool.c
index 6964498..535f355 100644
--- a/core/tarantool.c
+++ b/core/tarantool.c
@@ -171,7 +171,7 @@ tarantool_uptime(void)

 #ifdef STORAGE
 int
-snapshot(void *ev __unused__, int events __unused__)
+snapshot(void *ev, int events __unused__)
 {
  pid_t p = fork();
  if (p < 0) {
@@ -179,9 +179,10 @@ snapshot(void *ev __unused__, int events __unused__)
   return -1;
  }
  if (p > 0) {
- wait_for_child(p);
-
- assert(p == fiber->cw.rpid);
+ if (ev == NULL) { /* we'r called not from ev callback */
+ wait_for_child(p);
+ assert(p == fiber->cw.rpid);
+ }

   return WEXITSTATUS(fiber->cw.rstatus);
  }