<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40600 >

> [arch.and...@mail.ru - Wed Dec 17 15:51:23 2008]:
> 
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=40600 >
> >   
> >> [arch.and...@mail.ru - Sun Dec 14 11:38:50 2008]:
> >>
> >> Good day!
> >> Today I'm upgraded to new version of freeciv (2.1.8)
> >> and server begins disconnecting my client with this message
> >>
> >> 2: Lost connection: Andrey from localhost [...]
> >> 1: cut connection [...] due to huge send buffer (2)
> >>
> >> No other technical information received or displayed on
> >> the screen.
> >>     
> >
> > I'm not sure how that particular error condition could have
> > been triggered, though it could be due to some changes I made
> > trying to fix other connection related bugs.
> >
> > What system are you running on (e.g. windows, linux, osx, etc.)
> > and what exactly are you doing to cause the error to occur?
> > Are you trying to start a new local game, or connecting to
> > some server on the internet? Also, does the error always occur,
> > or only sometimes?
> 
>
> This error was returned on server console in process of
> current turn (after pressing end turn button in the client
> application but before turn calculation complete).  Server
> stay work but client should be reconnected.  I'm running
> local server and client applications under Windows XP sp2.
>
> I'll make some tests like downgrade to lower version but
> error does not disappear.  In the next test I'm set network
> parameters "connection block" and "max seconds for network
> buffer to drain" to higher values and it's help, error
> doesn't currently present.  But I think if count of cities
> and units in the game increased this error can return.
>
> If it's need I can send save file. Now total count of
> cities in the game world near 1000 and total count of units
> near 6000. World size 30k tiles. Turn calculating time
> near 4 minutes.  I have good hardware (Core2Quad Q6600,
> and 4Gb RAM) this should be enough for gaming in big maps.

Thank you for the detailed information, I think I know
what is going on. Unfortunately it is a known design
bug that the current freeciv network code behaves badly in
extreme circumstances (long latency and large data sends),
and there is no easy way to fix this without a substantial
redesign and rewrite.

In your case I think the server tries to send a very large
amount of data at once using buffering and this causes the
buffer to exceed its maximum capacity. This is probably
unavoidable on very large maps with many cities and units.

This could be temporarily fixed by increasing the maximum
buffer size from 524288 bytes to say 4 MB, but this limit
is hard-coded in the program and would require a recompile
to change.

Anyway here is a patch that increases the limit for freeciv
2.1.8; I will think about making this configurable without
recompiling, or perhaps how to redesign the network code
without too much grief.


-----------------------------------------------------------------------
そんな大きいもの、入るわけないよ!
diff --git a/common/connection.c b/common/connection.c
index 48fc429..ad7bb17 100644
--- a/common/connection.c
+++ b/common/connection.c
@@ -136,7 +136,7 @@ static bool buffer_ensure_free_extra_space(struct socket_packet_buffer *buf,
     buf->nsize = buf->ndata + extra_space;
 
     /* added this check so we don't gobble up too much mem */
-    if (buf->nsize > MAX_LEN_BUFFER) {
+    if (buf->nsize > 4 * 1024 * 1024) {
       return FALSE;
     }
     buf->data = (unsigned char *) fc_realloc(buf->data, buf->nsize);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to