public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Marco Monguzzi" <marco@sitek.it>
To: "Hugo 'NOx' Tyson" <hmt@cygnus.co.ukx>
Cc: <ecos-discuss@sourceware.cygnus.com>
Subject: RE: [ECOS] problems with MBUFs (TCP/IP stack)
Date: Tue, 11 Jul 2000 08:38:00 -0000	[thread overview]
Message-ID: <NCBBKIOHEKNFDFBEBPNHGEGNDOAA.marco@sitek.it> (raw)
In-Reply-To: <ptitud3qcx.fsf@masala.cygnus.co.uk>

> I've seen the out-of-mbufs issue in a variant of the ping test that I'm
> playing with, but as usual, it was cured by remembering to close
> the socket
> when I'm done with it.  That cures it anyway, it seems.
>
> Maybe it depends on what you do with the socket even if you do close it?
>
> Just a data point.

Hello.
Even the below (dummy) client works (running on target server_test.c that
shows the MBUFs counter we got no problems). The problem (the MBUFs not
freed
that generate the panic/warning) occours using the telnet client via shell
(or with this code if you comment the line "close(sockfd);").

In other words, when only the server closes the connection.

We observed the same path running the Web server. The connection is
established,
the web server honours the HTTP request and it closes (two steps: shutdown()
in
SHUT_WR mode + close() ). But, at the end, the MBUF counter shows that one
MBUF has
not been freed for each request served.

Regards,
Marco



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>

#define SERVER_HOST_ADDR "192.168.0.116" //target IP
#define SERVER_TCP_PORT 7734
#define NTIMES 100

int main(int argc, char* argv[]){
    int sockfd, len, ii;
    struct sockaddr_in serv_addr;
    char out[256];
    char in[256];

    if(argc != 2){
      printf("usage: client_test \"string to be sent\"\n");
      exit(-1);
    }
    strcpy(out, argv[1]);

    bzero((char*) &serv_addr, sizeof(serv_addr));
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = inet_addr(SERVER_HOST_ADDR);
    serv_addr.sin_port = htons(SERVER_TCP_PORT);


    for(ii=0; ii<NTIMES; ii++){
      if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    printf("cannot open stream socket!\n");
    exit(-1);
      }
      if ( connect(sockfd, (struct sockaddr_in *) &serv_addr,
sizeof(serv_addr)) < 0) {
    printf("cannot connect to the server!\n");
    exit(-1);
      }

      len = read(sockfd, in, sizeof(in));
      in[len-1] = '\0';
      printf("connected! read %d bytes from target:%s\n", len, in);
      write(sockfd, out, sizeof(out));
      close(sockfd);
    }
    exit(0);
 }


      reply	other threads:[~2000-07-11  8:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-08  5:54 Marco Monguzzi
2000-07-08  8:26 ` Grant Edwards
2000-07-08 11:45   ` Marco Monguzzi
2000-07-08 12:05     ` Marco Monguzzi
2000-07-10  8:50     ` Grant Edwards
2000-07-10  9:53       ` Gary Thomas
2000-07-10 10:21       ` Marco Monguzzi
2000-07-10 10:33         ` Grant Edwards
2000-07-10 10:41         ` Gary Thomas
2000-07-10 11:18           ` Marco Monguzzi
2000-07-10 13:03       ` Grant Edwards
2000-07-11  3:45         ` Hugo 'NOx' Tyson
2000-07-11  8:38           ` Marco Monguzzi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NCBBKIOHEKNFDFBEBPNHGEGNDOAA.marco@sitek.it \
    --to=marco@sitek.it \
    --cc=ecos-discuss@sourceware.cygnus.com \
    --cc=hmt@cygnus.co.ukx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).