Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ Running the server ➜ comm.c EOF Encountered on read

comm.c EOF Encountered on read

Posting of new messages is disabled at present.

Refresh page


Posted by Benjamin Peters   (5 posts)  Bio
Date Thu 15 Dec 2022 03:49 AM (UTC)

Amended on Thu 15 Dec 2022 04:15 PM (UTC) by Benjamin Peters

Message
Running SWRFUSS 1.3 that I've modified. Everything compiles clean, runs indefinitely without crash... however I keep seeing the EOF error from bool read_from_descriptor on some connections. Inevitably it seems to end in a disconnect on their end.

The read_from_descriptor call in game_loop:
--------------------------------------------

            d->fcommand = FALSE;

            if( FD_ISSET( d->descriptor, &in_set ) )
            {
               compressEnd(d); // Disable MCCP
               d->idle = 0;
               if( d->character )
                  d->character->timer = 0;
               if( !read_from_descriptor( d ) )
               {
                  FD_CLR( d->descriptor, &out_set );
                  if( d->character && ( d->connected == CON_PLAYING || d->connected == CON_EDITING ) )
                     save_char_obj( d->character );
                  d->outtop = 0;
                  close_socket( d, FALSE );
                  continue;
               }
            }


--------------------------------------------

bool read_from_descriptor( DESCRIPTOR_DATA * d )
{
   int iStart;

   /*
    * Hold horses if pending command already. 
    */
   if( d->incomm[0] != '\0' )
      return TRUE;

   /*
    * Check for overflow. 
    */
   iStart = strlen( d->inbuf );
   if( iStart >= sizeof( d->inbuf ) - 10 )
   {
      sprintf( log_buf, "%s input overflow!", d->host );
      log_string( log_buf );
      write_to_descriptor( d, "\r\n*** PUT A LID ON IT!!! ***\r\n", 0 );
      return FALSE;
   }

   for( ;; )
   {
      int nRead;

//      nRead = read( d->descriptor, d->inbuf + iStart, sizeof( d->inbuf ) - 10 - iStart );

      nRead = recv (d->descriptor, d->inbuf + iStart, sizeof (d->inbuf) - 10 - iStart, 0);
    if( nRead > 0 )
      {
         iStart += nRead;
         if( d->inbuf[iStart - 1] == '\n' || d->inbuf[iStart - 1] == '\r' )
            break;
      }
      else if( nRead == 0 )
      {
         log_string_plus( "EOF encountered on read. Something Amiss", LOG_COMM, sysdata.log_level );
         return FALSE;
      }
      else if( errno == EWOULDBLOCK )
         break;
      else
      {
         perror( "Read_from_descriptor" );
         return FALSE;
      }
   }

   d->inbuf[iStart] = '\0';
   return TRUE;
}

--------------------------------------------------
I figured this might be a client end issue with MCCP so I added compressEnd to a few choice spots within the connection functions and hotboot.

This has solved instances of folks that would be DC'ed on hotboot(the disabling of MCCP in hotboot.c). However I can't seem to solve the new connection DC issue for others.

So I know it's returning a false check because nRead == 0 but why it's coming to that is beyond me.


Anyone else run into this on SWRFUSS or SmaugFUSS?
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Thu 15 Dec 2022 03:58 PM (UTC)

Amended on Thu 15 Dec 2022 03:59 PM (UTC) by Fiendish

Message
Template:codetag To make your code more readable please use [code] tags as described here.


[code]
this is code
it has indents
[/code]

this is code
    it has indents

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #2 on Thu 15 Dec 2022 04:15 PM (UTC)

Amended on Thu 15 Dec 2022 04:16 PM (UTC) by Fiendish

Message
Why did you replace read with recv? The behavior on zero-length datagrams is different. A return of 0 from recv does not necessarily mean EOF.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Benjamin Peters   (5 posts)  Bio
Date Reply #3 on Thu 15 Dec 2022 04:16 PM (UTC)

Amended on Thu 15 Dec 2022 04:27 PM (UTC) by Benjamin Peters

Message
Was the first ham fisted attempt I tried to see if it would make a difference.
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #4 on Thu 15 Dec 2022 04:26 PM (UTC)

Amended on Thu 15 Dec 2022 05:05 PM (UTC) by Fiendish

Message
What is the value of
sizeof( d->inbuf ) - 10 - iStart

when you see the problem?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Benjamin Peters   (5 posts)  Bio
Date Reply #5 on Thu 15 Dec 2022 04:58 PM (UTC)
Message

(gdb) print *d
$1 = {
  next = 0x0,
  prev = 0x146aae0,
  snoop_by = 0x0,
  character = 0x0,
  original = 0x0,
  mccp = 0x146c450,
  can_compress = 0 '\000',
  host = 0x1398650 "grapevine.haus",
  hostip = 0x0,
  port = 42333,
  descriptor = 6,
  connected = -99,
  idle = 0,
  lines = 0,
  scrlen = 24,
  fcommand = 0 '\000',
  inbuf = "\000\376Vmssp-request\n", '\000' <repeats 1007 times>,
  incomm = "\000ssp-request", '\000' <repeats 1011 times>,
  inlast = "mssp-request", '\000' <repeats 1011 times>,
  repeat = 0,
  outbuf = 0x139f6b0 "Illegal name, try another.\r\nName: ",
  outsize = 2000,
  outtop = 0,
  pagebuf = 0x0,
  pagesize = 0,
  pagetop = 0,
  pagepoint = 0x0,
  pagecmd = 0 '\000',
  pagecolor = 0 '\000',
  newstate = 0,
  prevcolor = 7 '\a'
}


Still trying to figure out all the proper commands in gdb
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #6 on Thu 15 Dec 2022 05:04 PM (UTC)

Amended on Thu 15 Dec 2022 05:05 PM (UTC) by Fiendish

Message
That output doesn't answer my question. I've edited the formatting to make the question more clear.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Benjamin Peters   (5 posts)  Bio
Date Reply #7 on Thu 15 Dec 2022 05:29 PM (UTC)

Amended on Thu 15 Dec 2022 05:44 PM (UTC) by Benjamin Peters

Message

Log: [*****] BUG: comm.c: sizeof(d->inbuf) - 10 - iStart = 1014
Comm: EOF encountered on read. Something Amiss


Sorry, looks like 1014.
Which means very little to me since network function are basically a foreign language for me. Lol
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #8 on Fri 16 Dec 2022 12:40 AM (UTC)
Message
It seems like the EOF from read is telling you about the disconnect, not causing it.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Benjamin Peters   (5 posts)  Bio
Date Reply #9 on Fri 16 Dec 2022 12:50 AM (UTC)

Amended on Fri 16 Dec 2022 12:52 AM (UTC) by Benjamin Peters

Message
Very confusing, the bug log is just something I added to see the buffer values. However still thinking it has to be some sort of client side issue since it doesn't affect all players. Would definitely like to figure it out since any lost players truly is a shame with how niche the hobby is.

Wish I understood the read function better in general, curious as to what it actually means when nRead == 0. Has to be some reason to not just comment it out. ;)


Might just have to test out eliminating MCCP altogether and see if that helps.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #10 on Fri 16 Dec 2022 06:38 AM (UTC)
Message
I think Fiendish could assure you that Aardwolf runs with a MUSHclient front-end for a lot of players, and random disconnections (being the client's fault) are not a big problem.

It is more likely to be a server issue.

You could try disabling MCCP just to rule that out as an issue. These days with fast Internet connections it is probably not as useful as it was when people had slow-speed modems.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,872 views.

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.