Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-02-04 Thread Thomas Moschny
Adam Panayis wrote:
> Hi, I have the same problem as described here:
> http://www.mail-archive.com/monotone-devel@nongnu.org/msg12494.html
> 
> Is there way to get the revised code before the next full release of
> monotone?

You could try the attached patch, it should fix the problem. It is
rediffed version of Markus' patch in revision f18abebd.. on mainline.

- Thomas
diff -up monotone-0.42/netsync.cc.orig monotone-0.42/netsync.cc
--- monotone-0.42/netsync.cc.orig	2009-02-04 13:53:00.0 +0100
+++ monotone-0.42/netsync.cc	2009-02-04 13:53:49.0 +0100
@@ -353,7 +353,7 @@ unsigned int reactable::count = 0;
 
 class session_base : public reactable
 {
-  bool read_some();
+  void read_some(bool & failed, bool & eof);
   bool write_some();
   void mark_recent_io()
   {
@@ -468,10 +468,12 @@ session_base::which_events()
   return ret;
 }
 
-bool
-session_base::read_some()
+void
+session_base::read_some(bool & failed, bool & eof)
 {
   I(inbuf.size() < constants::netcmd_maxsz);
+  eof = false;
+  failed = false;
   char tmp[constants::bufsz];
   Netxx::signed_size_type count = str->read(tmp, sizeof(tmp));
   if (count > 0)
@@ -479,17 +481,38 @@ session_base::read_some()
   L(FL("read %d bytes from fd %d (peer %s)")
 % count % str->get_socketfd() % peer_id);
   if (encountered_error)
-{
-  L(FL("in error unwind mode, so throwing them into the bit bucket"));
-  return true;
-}
+L(FL("in error unwind mode, so throwing them into the bit bucket"));
+
   inbuf.append(tmp,count);
   mark_recent_io();
   note_bytes_in(count);
-  return true;
+}
+  else if (count == 0)
+{
+  // Returning 0 bytes after select() marks the file descriptor as
+  // ready for reading signifies EOF.
+
+  switch (protocol_state)
+{
+case working_state:
+  P(F("peer %s IO terminated connection in working state (error)")
+% peer_id);
+  break;
+
+case shutdown_state:
+  P(F("peer %s IO terminated connection in shutdown state "
+  "(possibly client misreported error)")
+% peer_id);
+  break;
+
+case confirmed_state:
+  break;
+}
+
+  eof = true;
 }
   else
-return false;
+failed = true;
 }
 
 bool
@@ -531,11 +554,14 @@ bool
 session_base::do_io(Netxx::Probe::ready_type what)
 {
   bool ok = true;
+  bool eof = false;
   try
 {
   if (what & Netxx::Probe::ready_read)
 {
-  if (!read_some())
+  bool failed;
+  read_some(failed, eof);
+  if (failed)
 ok = false;
 }
   if (what & Netxx::Probe::ready_write)
@@ -578,7 +604,11 @@ session_base::do_io(Netxx::Probe::ready_
 % peer_id);
   ok = false;
 }
-  return ok;
+
+  // Return false in case we reached EOF, so as to prevent further calls
+  // to select()s on this stream, as recommended by the select_tut man
+  // page.
+  return ok && !eof;
 }
 
 
___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-30 Thread Markus Wanner
Hi,

Adam Panayis wrote:
> Is there way to get the revised code before the next full release of
> monotone?

Your best bet is to pull the branch net.venge.monotone from monotone.ca
and build from source, I guess. Maybe downgrading is another option?

On what platform or OS are you?

Regards

Markus Wanner



___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-30 Thread Adam Panayis
Hi, I have the same problem as described here: 
http://www.mail-archive.com/monotone-devel@nongnu.org/msg12494.html


Is there way to get the revised code before the next full release of 
monotone?


Thanks.


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-04 Thread Zack Weinberg
On Sun, Jan 4, 2009 at 10:22 AM, Markus Wanner  wrote:
> This has to do with your changes to netsync between 0.41 and 0.42
> (b0fcf9be.. by Timothy 2008-10-18, per mtn annotate). AFAICT select() is
> saying the file descriptor is ready for reading, while reading from the
> file descriptor returns 0 bytes. According to the man page for read(),
> returning less than the requested amount of bytes is fine, only return
> values < 0 signify an error. The select_tut man page clearly indicates,
> that after getting zero bytes from read() or recv(), one should not call
> select() on the fd anymore.
>
> I'm not overly familiar with netsync, but tried to fix it anyway. Please
> review rev. f18abebd..

I'm not deeply familiar with netsync myself, but it looks good to me.

zw


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-04 Thread Markus Wanner
Hello Timothy,

Markus Wanner wrote:
> Ralf S. Engelschall wrote:
>> | mtn: peer monotone.ca IO failed in confirmed state (success)
>> | mtn: successful exchange with monotone.ca
> 
> I can reproduce this on a i386 FreeBSD 6.4 and will try to hunt the bug
> - sometime this month. Thank you for reporting this.

This has to do with your changes to netsync between 0.41 and 0.42
(b0fcf9be.. by Timothy 2008-10-18, per mtn annotate). AFAICT select() is
saying the file descriptor is ready for reading, while reading from the
file descriptor returns 0 bytes. According to the man page for read(),
returning less than the requested amount of bytes is fine, only return
values < 0 signify an error. The select_tut man page clearly indicates,
that after getting zero bytes from read() or recv(), one should not call
select() on the fd anymore.

I'm not overly familiar with netsync, but tried to fix it anyway. Please
review rev. f18abebd..

Unit tests work fine on Debian sid, FreeBSD 6.4 and Gentoo 2008.0 and
the misleading error reported by Ralf has disappeared.

Regards

Markus Wanner


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-04 Thread Markus Wanner
Hello Timothy,

Markus Wanner wrote:
> Ralf S. Engelschall wrote:
>> | mtn: peer monotone.ca IO failed in confirmed state (success)
>> | mtn: successful exchange with monotone.ca
> 
> I can reproduce this on a i386 FreeBSD 6.4 and will try to hunt the bug
> - sometime this month. Thank you for reporting this.

This has to do with your changes to netsync between 0.41 and 0.42
(b0fcf9be.. by Timothy 2008-10-18, per mtn annotate). AFAICT select() is
saying the file descriptor is ready for reading, while reading from the
file descriptor returns 0 bytes. According to the man page for read(),
returning less than the requested amount of bytes is fine, only return
values < 0 signify an error. The select_tut man page clearly indicates,
that after getting zero bytes from read() or recv(), one should not call
select() on the fd anymore.

I'm not overly familiar with netsync, but tried to fix it anyway. Please
review rev. f18abebd..

Unit tests work fine on Debian sid, FreeBSD 6.4 and Gentoo 2008.0 and
the misleading error reported by Ralf has disappeared.

Regards

Markus Wanner


___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2009-01-03 Thread Markus Wanner
Hello Ralf,

Ralf S. Engelschall wrote:
> | $ mtn sync
> | mtn: connecting to monotone.ca
> | mtn: finding items to synchronize:
> | mtn: certificates | keys | revisions
> | mtn:43794 |   57 | 14424
> | mtn: bytes in | bytes out | revs in | revs out
> | mtn:   87.0 k | 7.0 k | 1/1 |  0/0
> | mtn: peer monotone.ca IO failed in confirmed state (success)
> | mtn: successful exchange with monotone.ca

I can reproduce this on a i386 FreeBSD 6.4 and will try to hunt the bug
- sometime this month. Thank you for reporting this.

Regards

Markus Wanner



___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


Re: [Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2008-12-29 Thread Ralf S. Engelschall
On Mon, Dec 29, 2008, Ralf S. Engelschall wrote:

> Ops, today with the new Monotone 0.42 I always get an interesting new
> message "peer [...] IO failed in confirmed state (success)" during
> NETSYNC, although the NETSYNC revision transfer seems to work still
> fine:
>
> $ mtn sync
> mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> mtn: finding items to synchronize:
> mtn: certificates | keys | revisions
> mtn: 5798 |2 |  1929
> mtn: bytes in | bytes out | certs out | revs out
> mtn:4.5 k | 6.4 k |   4/4 |  1/1
> mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
> confirmed state (success)
> mtn: successful exchange with 
> ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> $ mtn sync
> mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> mtn: finding items to synchronize:
> mtn: certificates | keys | revisions
> mtn: 5798 |2 |  1929
> mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
> confirmed state (success)
> mtn: successful exchange with 
> ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> mtn: bytes in | bytes out | revs in
> mtn:  934 |   943 | 0/0
> $ mtn sync
> mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> mtn: finding items to synchronize:
> mtn: certificates | keys | revisions
> mtn: 5798 |2 |  1929
> mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
> confirmed state (success)
> mtn: successful exchange with 
> ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
> mtn: bytes in | bytes out | revs in
> mtn:  934 |   943 | 0/0
>
> As you can see, on the first "mtn sync", my new revision was synced
> upstream just fine, although I got this message. So, is this just a
> strange message (because of the "failed" + "success" info) in Monotone
> 0.42 or is there really a problem somewhere?
>
> The NETSYNC peer is still running Monotone 0.41, BTW...

OK, I've upgraded the peer now also to Monotone 0.42, but the above
"failed... (success)" message still exists. So, it is at least not
related to any NETSYNC incompatibilities.

And, BTW, it also happens against monotone.ca for me now:

| $ mtn sync
| mtn: connecting to monotone.ca
| mtn: finding items to synchronize:
| mtn: certificates | keys | revisions
| mtn:43794 |   57 | 14424
| mtn: bytes in | bytes out | revs in | revs out
| mtn:   87.0 k | 7.0 k | 1/1 |  0/0
| mtn: peer monotone.ca IO failed in confirmed state (success)
| mtn: successful exchange with monotone.ca

   Ralf S. Engelschall
   r...@engelschall.com
   www.engelschall.com



___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel


[Monotone-devel] Monotone 0.42: "peer [...] IO failed in confirmed state (success)"?

2008-12-29 Thread Ralf S. Engelschall
Ops, today with the new Monotone 0.42 I always get an interesting new
message "peer [...] IO failed in confirmed state (success)" during
NETSYNC, although the NETSYNC revision transfer seems to work still
fine:

$ mtn sync
mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
mtn: finding items to synchronize:
mtn: certificates | keys | revisions
mtn: 5798 |2 |  1929
mtn: bytes in | bytes out | certs out | revs out
mtn:4.5 k | 6.4 k |   4/4 |  1/1
mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
confirmed state (success)
mtn: successful exchange with 
ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
$ mtn sync
mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
mtn: finding items to synchronize:
mtn: certificates | keys | revisions
mtn: 5798 |2 |  1929
mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
confirmed state (success)
mtn: successful exchange with 
ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
mtn: bytes in | bytes out | revs in
mtn:  934 |   943 | 0/0
$ mtn sync
mtn: connecting to ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
mtn: finding items to synchronize:
mtn: certificates | keys | revisions
mtn: 5798 |2 |  1929
mtn: peer ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/ IO failed in 
confirmed state (success)
mtn: successful exchange with 
ssh://openpkg-...@mtn.openpkg.org/openpkg-framework/
mtn: bytes in | bytes out | revs in
mtn:  934 |   943 | 0/0

As you can see, on the first "mtn sync", my new revision was synced
upstream just fine, although I got this message. So, is this just a
strange message (because of the "failed" + "success" info) in Monotone
0.42 or is there really a problem somewhere?

The NETSYNC peer is still running Monotone 0.41, BTW...

   Ralf S. Engelschall
   r...@engelschall.com
   www.engelschall.com



___
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel