Commit 2a5df862 authored by Wayne Davison's avatar Wayne Davison

- Fixed a potential hang bug in wait_for_receiver() that could occur

  if the io_flush() call happened to read the last message from the
  receiver, causing the read_msg_fd() call to deadlock.
- Fixed an error-looping problem when the server-side receiver failed
  to send a message down the error-msg pipe:  we no longer try to send
  a new error about this new failure down the same failing pipe.
- Make sure that we stop any deferring of forwarded messages in the
  generator when we are exiting with an error.
parent 3ea6e0e7
......@@ -485,8 +485,10 @@ void send_msg_int(enum msgcode code, int num)
void wait_for_receiver(void)
{
io_flush(NORMAL_FLUSH);
read_msg_fd();
if (iobuf_out_cnt)
io_flush(NORMAL_FLUSH);
else
read_msg_fd();
}
int get_redo_num(void)
......@@ -601,8 +603,10 @@ static int read_timeout(int fd, char *buf, size_t len)
count = select(maxfd + 1, &r_fds, &w_fds, NULL, &tv);
if (count <= 0) {
if (errno == EBADF)
if (errno == EBADF) {
defer_forwarding_messages = 0;
exit_cleanup(RERR_SOCKETIO);
}
check_timeout();
continue;
}
......@@ -1286,6 +1290,9 @@ static void writefd_unbuffered(int fd, const char *buf, size_t len)
/* Don't try to write errors back across the stream. */
if (fd == sock_f_out)
io_end_multiplex_out();
/* Don't try to write errors down a failing msg pipe. */
if (am_server && fd == msg_fd_out)
exit_cleanup(RERR_STREAMIO);
rsyserr(FERROR, errno,
"writefd_unbuffered failed to write %ld bytes [%s]",
(long)len, who_am_i());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment