Custom Query (541 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (55 - 57 of 541)

Ticket Resolution Summary Owner Reporter
#43 fixed wave_severV fix for end of tank reads paulf paulf
Description

As reported on the EW List, I think there is a bug in wave_serverV code. I don't have my machine setup to access the current EW repository, and don't think I have the latest code (although I'm guessing the code section in question hasn't changed).

I think the source of the bug is a bad Offset pointer to ReadBlockData?() in LocateExactOffset?() for a FLAG_R search. It looks like it's possible to have LocatreRoughOffset?() return a record pointer to the end of the tank for a FLAG_R search. When the time for this record is prior to the search time, it's possible for that pointer to be passed directly into ReadBlockData?().

The problem lies just above the last call to ReadBlockData?() in LocateExactOffset?() in serve_trace.c. In the version of the code I have, it's ~ line 1023

A fix would be to wrap the current offset if it is >= the tanksize, before adjusting the temp offset.

Added code for the fix is highlighted in bold below (tagged with DK 20100311).

Like I said above, I don't have my machine configured to access the EW code repository, and I don't have the facilities to test the fix. Could anyone else test and integrate this fix?

-david

/************** CODE SNIPPET  ***********/
  else  /*  flag == FLAG_R */
  {
    long int tmp = off-rsz;

    if(tmp < 0)
      tmp+=tsz;

    if ( ReadBlockData(tfp, tmp, (long int) sizeof(TRACE2_HEADER),
                       (char*) &trace_h ) != R_DONE )
    {
      strncpy(szFileFunction,"ReadBlockData",sizeof(szFileFunction));
      szFileFunction[sizeof(szFileFunction)]= 0;
      iFileOffset     = tmp;
      iFileBlockSize  = sizeof(TRACE2_HEADER);
      szFileTankName  = t->tankName;   /* don't copy just point */
      goto ReadBlockDataFailed;
    }
    while (trace_h.starttime > reqt)  /* if reqt is to the left keep going */
    {
      off=tmp;
      tmp-=rsz;
      DFIP+=rsz;
      if(DFIP <= 0 || DFIP >= tsz)
      {
        logit("t","Failed DFIP comparison #3\n");
        goto OHCRAP;
      }

      /* for the left boundary, set off = 0 if off == tsz */
      if ( tmp < 0 )
        tmp += tsz;
     
      if ( ReadBlockData( tfp, tmp, (long int) sizeof(TRACE2_HEADER),
                          (char*) &trace_h ) != R_DONE )
      {
        strncpy(szFileFunction,"ReadBlockData",sizeof(szFileFunction));
        szFileFunction[sizeof(szFileFunction)]= 0;
        iFileOffset     = tmp;
        iFileBlockSize  = sizeof(TRACE2_HEADER);
        szFileTankName  = t->tankName;   /* don't copy just point */
        goto ReadBlockDataFailed;
      }
    }  /* End while(acct < reqt) */

    if(trace_h.endtime + GRACE_PERIOD >= reqt)
    {
      /* We've found our spot.  trace_h.starttime < reqt <= trace_h.endtime.
         Pack it up and go home */
      *acttp=trace_h.endtime;
      *offp=off;
    }
    else
    {
      /* There was some sort of a minor snaffu.  Throw it in reverse,
         but keep track of what we've got.
      */
      double tempEnd=trace_h.endtime;

      while (trace_h.endtime + GRACE_PERIOD < reqt)
        /* Use GRACE_PERIOD to account for sloppy timestamps */
      {
        /* Keep going backwards until we hit the wall, or get to a good time */
        /* LocateRoughOffset can return off = tsz, and if the rough-offset return
           was ahead of our target time, we could read off the end of the tank.
           DK 20100311 */
        if ( off >=tsz ) 
          off=0;
        tmp=off;
        off += rsz;
        DFIP -= rsz;
        if(DFIP <= 0 || DFIP >= tsz)
        {
          logit("t","Failed DFIP comparison #4\n");
          goto OHCRAP;
        }
        if ( off >=tsz )
          off=0;
        tempEnd=trace_h.endtime;
        if ( ReadBlockData( tfp, tmp, (long int) sizeof(TRACE2_HEADER),
                            (char*) &trace_h ) != R_DONE )
        {
          strncpy(szFileFunction,"ReadBlockData",sizeof(szFileFunction));
          szFileFunction[sizeof(szFileFunction)]= 0;
          iFileOffset     = tmp;
          iFileBlockSize  = sizeof(TRACE2_HEADER);
          szFileTankName  = t->tankName;   /* don't copy just point */
          goto ReadBlockDataFailed;
        }


/************** END CODE SNIPPET  ***********/

#45 fixed wave_serverV logging change to alert about client IP paulf paulf
Description

This request came from Mike Hagerty, code fix is from Dave Kragness.

Paul,
Here's the code for printing out WS client  IP addr and thread #.  I wasn't sure what exactly changed, so I included chunks of code at a time, when probably only 1 line in the chunk has changed.

If this turns out to be clear as mud, let me know.

-david

in equiv of server_thread.c I have:

/********* START CODE SNIPPET *********/

int ListenForMsg( int iSocketDesc, char *pRcvBuffer, int iMyThreadID)
     /* Returns <0 if error; Reads individual characters from a file
      * descriptor <iSocketDesc> into the supplied buffer <pRcvBuffer> until
      * either we run out of buffer space (returning ERR_OVRFLOW) or we find a
      * newline character on the * input stream (returning the number of
      * characters read, including the newline)...  */

      /* This function should not be reading in one char at a time.
         This is a lot of overhead.
         DavidK 9/21/98
      */

{
  int             iCIndex;
  int             iReadResult;

  /*              Validate params: */
  ew_assert(iSocketDesc > 0, __LINE__);
  ew_assert((BOOL)pRcvBuffer, __LINE__);

  if (iWS6ServerDebug >= WS6_DEBUG_ADVANCED_USER)
     logit("et", "ListenForMsg: listening at the socket[%d]... \n", iMyThreadID);

  /* Listen to the socket for incoming characters until our buffer is full... */
  /* Note: pRcvBuffer now declared as kMAX_CLIENT_MSG_LEN+1 so we can't overrun
     buffer with the appended null byte (null byte is not part of message) */
  for (iCIndex = 0 ; iCIndex < kMAX_CLIENT_MSG_LEN ; iCIndex++)
  {
    iReadResult = recv_ew(iSocketDesc, &pRcvBuffer[iCIndex], 1, 0,
                          ClientTimeout);
    if (iReadResult==1 && pRcvBuffer[iCIndex] == '\n')
    {
      /* If we got a newline, we're done gathering */
      pRcvBuffer[iCIndex + 1] = '\0';
      return 1;
    }
    if (iReadResult <= 0)
    {
      if(iReadResult == 0)
      {
        logit("t","ws6_server:  Client closed socket.\n");
        return 0;
      }
      else
      {
        if(iCIndex == 0)
        {
          if(socketGetError_ew() == WOULDBLOCK_EW)
            logit("t","ws6_server:  Client socket[%d:%s] timed out.\n", iMyThreadID, client_ip[iMyThreadID]);
          else
            if (iWS6ServerDebug >= WS6_DEBUG_ADVANCED_USER)
              logit("t","ws6_server:  Client closed socket[%d:%s] (quickly).\n", iMyThreadID, client_ip[iMyThreadID]);
          return 0;
        }
        logit("et","ws6_server:ListenForMsg[%d:%s]: Bad socket read. "
                   "iReadResult = %d\n", iMyThreadID, client_ip[iMyThreadID], iReadResult);
        /* Broken socket.  Client must have gone away... */
        return -2;
      }
    }  /* end if (iReadResult <= 0) */
  }  /* end for (iCIndex < kMAX_CLIENT_MSG_LEN) */
  logit( "","ListenForMsg[%d:%s]: Error - message buffer overflow\n", iMyThreadID, client_ip[iMyThreadID]);
  return -3;
}

/********* END CODE SNIPPET *********/

in wave_serverV.h, I have

/********* START CODE SNIPPET *********/

typedef char szIP16[16];  /* used to store IP addr of client */

extern szIP16 * client_ip;  /* Array of client IP addresses (one per server thread)   */

/********* END CODE SNIPPET *********/


and in equiv of wave_serverV.c in  ServerMgr() thread (just avove the StartThreadWithArg() call to fire up the server thread,  I have


/********* START CODE SNIPPET *********/


    strcpy( client_ip[freeThrd], inet_ntoa(client[freeThrd].sin_addr) );
    if (iWS6ServerDebug >= WS6_DEBUG_ADVANCED_USER)
      logit("t","[A%d:%s](%d)\n", freeThrd, strrchr(client_ip[freeThrd],'.') ? strrchr(client_ip[freeThrd],'.') : "<UNKNOWN>",
            ServerThreadInfo[freeThrd].ActiveSocket);
    else
      printf("[A%d:%s]\n", freeThrd, strrchr(client_ip[freeThrd],'.') ? strrchr(client_ip[freeThrd],'.') : "<UNKNOWN>" );

    /* Start the Server thread
     **************************/
    if (iWS6ServerDebug >= WS6_DEBUG_ADVANCED_USER)
      logit("","Starting ServerThread %d \n",freeThrd);
   
    if ( StartThreadWithArg(  ServerThread, &freeThrd, (unsigned)THREAD_STACK, &tidSockSrv[freeThrd] )  == -1 )
    {
      logit( "e", "ws6_server: Error starting  SocketSender thread. Exiting.\n" );
      closesocket_ew( ServerThreadInfo[freeThrd].ActiveSocket,
                      SOCKET_CLOSE_IMMEDIATELY_EW );
      goto HeavyRestart;
    }

/********* END CODE SNIPPET *********/


I think that's



Paul Friberg wrote:
> Great, thanks. EW7.4 is ready to be pushed soon. I just finished clean compilation tests
> on 4 OS's (SPARC solaris, Win XP, Fedora Core Linux, Mac OS X).
>
> Cheers,
>
> Paul
>
> David Kragness wrote:
>   
>> Paul,
>> I believe I have code to do most of what Pete describes below.
>> I'll send it to you when I get a chance.
>> -david
>>
>> Peter Lombard wrote:
>>     
>>> Paul,
>>>
>>> The wave_serverV protocol is pretty well described in the comments at the top
>>> of wave_serverV.c. It does not support passing the client name to the server.
>>>
>>> If you add the client hostname to the ServerThreadInfo struct, then it can be
>>> passed to the thread that handles the client connection after it has been
>>> accepted.
>>>
>>> Or you could modify the code to print the thread ID (index to ServerThreadInfo
>>> array) when the connection is accepted and when the connection closes. Then
>>> the log file reader could find the matching "Connection accepted" and "Client
>>> closed" log entries.
>>>
>>> Pete
>>>
>>>
>>> Paul Friberg writes:
>>>   >  Thanks Pete,
>>>   >
>>>   >  I am well aware of gethostbyaddr() ;^)  What I meant was that I don't know if the IP
>>>   >  info is available in the server client handling thread where the "Client closed socket" message is spewed out.
>>>   >
>>>   >  Also, you know the wave_serverV client code better than I, so maybe you can comment if the
>>>   >  protocol (which seems to never have been fully documented, in a document at least) has any
>>>   >  indication of the program name of the client.
>>>   >
>>>   >  Cheers,
>>>   >
>>>   >  Paul
>>>   >
>>>   >  Peter Lombard wrote:
>>>   >  >  Paul,
>>>   >  >
>>>   >  >  wave_serverV can try to look up the hostname from the IP address. See for
>>>   >  >  example the code in AQMS in lib/tntcp/TCPConnServer.C:
>>>   >  >
>>>   >  >  TCPConn* TCPConnServer::Accept()
>>>   >  >  {
>>>   >  >    int clientsd;
>>>   >  >    struct sockaddr_in claddr;
>>>   >  >    socklen_t claddrlen;
>>>   >  >    struct hostent *hp;
>>>   >  >    char *ipaddr;
>>>   >  >
>>>   >  >    if ((valid != TN_TRUE) || (mysession == NULL)) {
>>>   >  >      return(new TCPConn());
>>>   >  >    }
>>>   >  >
>>>   >  >    // Accept the next waiting client
>>>   >  >    claddrlen = sizeof(struct sockaddr_in);
>>>   >  >    clientsd = accept(mysession->sd, (struct sockaddr *)&claddr,&claddrlen);
>>>   >  >    if (clientsd<  0) {
>>>   >  >      std::cout<<  "Error (TCPConnServer::Accept): Failure accepting client"<<  std::endl;
>>>   >  >      return(new TCPConn());
>>>   >  >    }
>>>   >  >
>>>   >  >    // Retrieve the client address
>>>   >  >    hp = gethostbyaddr((char *)&(claddr.sin_addr.s_addr),
>>>   >  >                       sizeof(claddr.sin_addr.s_addr), AF_INET);
>>>   >  >    if (hp == NULL) {
>>>   >  >      ipaddr = inet_ntoa(claddr.sin_addr);
>>>   >  >      std::cout<<  "Error (TCPConnServer::Accept): Invalid client address:"
>>>   >  >           <<  ipaddr<<  std::endl;
>>>   >  >      close(clientsd);
>>>   >  >      return(new TCPConn());
>>>   >  >    }
>>>   >  >
>>>   >  >    return(new TCPConn(clientsd, Client(hp->h_name, claddr.sin_port)));
>>>   >  >  }
>>>   >  >
>>>   >  >  Pete
>>>   >  >
>>>   >  >
>>>   >  >  Paul Friberg writes:
>>>   >  >   >  Hi Mike,
>>>   >  >   >
>>>   >  >   >  It might be able to add the IP of the client, but unless the wave_serverV protocol
>>>   >  >   >  actually includes the name of the client, getting that information is impossible.
>>>   >  >   >
>>>   >  >   >  Dave Kragness might know as he knows this code best of all.
>>>   >  >   >
>>>   >  >   >  I have checked Dave's wave_serverV end of tank fix into cvs and test compiled, but
>>>   >  >   >  don't have a test environment that produces the error being seen.
>>>   >  >   >
>>>   >  >   >  if nobody on ewdev has this env, I will seek volunteers to test this from the
>>>   >  >   >  earthw list...time for earthw folks to help and step up for testing :)
>>>   >  >   >
>>>   >  >   >  Cheers,
>>>   >  >   >
>>>   >  >   >  Paul
>>>   >  >   >
>>>   >  >   >  Mike Hagerty wrote:
>>>   >  >   >  >  Hi Stefan (and everyone else).
>>>   >  >   >  >  I'm not sure if I'm already subscribed to this list - I guess I'll
>>>   >  >   >  >  know if I receive a copy of this.
>>>   >  >   >  >
>>>   >  >   >  >  I just wanted to suggest something:  It seems to me that wave_serverV
>>>   >  >   >  >  generates the most error messages
>>>   >  >   >  >  of any earthworm module (?).  It would be very helpful to know what
>>>   >  >   >  >  client is requesting data from wave_serverV
>>>   >  >   >  >  when an error message is generated.
>>>   >  >   >  >
>>>   >  >   >  >  So, for example, even something in the wave_serverV logfile like:
>>>   >  >   >  >     Wave_serverV:   Client closed socket.
>>>   >  >   >  >
>>>   >  >   >  >  It would be great to know *which* client it was (e.g., heli_ewII,
>>>   >  >   >  >  waveman2disk, ew2mseed ...) and the ip address
>>>   >  >   >  >  of the machine the client was running on.
>>>   >  >   >  >
>>>   >  >   >  >  Just my two cents.
>>>   >  >   >  >
>>>   >  >   >  >  Cheers,
>>>   >  >   >  >
>>>   >  >   >  >  -Mike Hagerty
>>>   >  >   >  >  _______________________________________________
>>>   >  >   >  >  Ewdev mailing list
>>>   >  >   >  >  Ewdev@isti.com
>>>   >  >   >  >  http://bigboy.isti.com/mailman/listinfo/ewdev
>>>   >  >   >
>>>   >  >   >  _______________________________________________
>>>   >  >   >  Ewdev mailing list
>>>   >  >   >  Ewdev@isti.com
>>>   >  >   >  http://bigboy.isti.com/mailman/listinfo/ewdev
>>>   >
>>>   >  _______________________________________________
>>>   >  Ewdev mailing list
>>>   >  Ewdev@isti.com
>>>   >  http://bigboy.isti.com/mailman/listinfo/ewdev
>>> _______________________________________________
>>> Ewdev mailing list
>>> Ewdev@isti.com
>>> http://bigboy.isti.com/mailman/listinfo/ewdev
>>>
>>>
>>>       
>> _______________________________________________
>> Ewdev mailing list
>> Ewdev@isti.com
>> http://bigboy.isti.com/mailman/listinfo/ewdev
>>     
>
> _______________________________________________
> Ewdev mailing list
> Ewdev@isti.com
> http://bigboy.isti.com/mailman/listinfo/ewdev
>
>   

#46 fixed sgram not being made for windows paulf paulf
Description

sgram was left out of the display/Makefile....why? Get it to compile on win for 7.4

Note: See TracQuery for help on using queries.