bugGluster - Bugs: bug #57465, raw tcp client API...

 
 

bug #57465: raw tcp client API connect&disconnect many times “ no segment to free” Assert failed in file tcp_in.c, line 884

Submitter:  Lucas <lucaslwip1699>
Submitted:  Mon 23 Dec 2019 07:09:05 AM UTC
   
 
Category:  GlusterFS User Interface Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Crash
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  *
Open/Closed:  Open Release:  2.1.2
Operating System:  None Reproducibility:  Every Time
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 23 Dec 2019 11:15:25 AM UTC, comment #2: 

sometimes will assert
pbuf_free: p->ref > 0
Assert failed in file lwip-2.1.2/src/core/pbuf.c, line 753

and the code is same before

and i test the connect & disconnect with the socket API ,it works very well , no error or assert occur in at least 2h, the raw tcp API will assert in 10 min

Lucas <lucaslwip1699>
Mon 23 Dec 2019 11:10:02 AM UTC, comment #1: 

original submission:

> Hi:
> i wanna implement a FTP client with raw tcp API,and i porting the lwip 2.1.2 release veersion on my FreeRTOS platform ,and then i do a simple code with connect and disconnect test
>
> the code is the code is below:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> err_t ftp_client_test(lwftp_session_t *s)
> {
>   err_t error = ERR_OK;
>   lwftp_results retval = LWFTP_RESULT_OK;
>   ip_addr_t ftp_server_address;
>  
>   IP4_ADDR(&ftp_server_address, 192,168,1,141);
>   s->server_ip.addr = ftp_server_address.addr;
>  
>   // Get sessions pcb
>   s->control_pcb = tcp_new();
>   if (!s->control_pcb)
>   {
>     LWIP_DEBUGF(LWFTP_SERIOUS, ("lwftp:cannot alloc control_pcb (low memory?)\n"));
>     retval = LWFTP_RESULT_ERR_MEMORY;
>   }
>   // Open control session
>   ip_addr_t server_ip;
>   u16_t server_port;
>   server_port = s->server_port;
>   server_ip   = s->server_ip;
>  
>   tcp_arg(s->control_pcb,  s);
>   tcp_err(s->control_pcb,  lwftp_control_err);
>   tcp_recv(s->control_pcb, lwftp_control_recv);
>   tcp_sent(s->control_pcb, lwftp_control_sent);
>   error = tcp_connect(s->control_pcb, &server_ip, server_port, lwftp_control_connected);
>   if ( error == ERR_OK )
>   {
>     retval = LWFTP_RESULT_INPROGRESS;
>   }
>
>   return retval;
> }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i trigger ftp_client_test period is 6s, and when connect success , the  lwftp_control_connected will be called ,code is below
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> static err_t ftp_control_connected(void *arg, struct tcp_pcb *tpcb, err_t err)
> {
>   lwftp_session_t s = (lwftp_session_t)arg;
>    err_t error;
>   if (tpcb)
>   {
>   s->control_pcb_pre = tpcb;
>
>   tcp_arg(tpcb,  NULL);
>   tcp_err(tpcb,  NULL);
>   tcp_recv(tpcb, NULL);
>   tcp_sent(tpcb, NULL);
>   error = tcp_close(tpcb);
>   if ( error != ERR_OK )
>   {
>     LWIP_DEBUGF(LWFTP_SEVERE, ("lwftp:pcb close failure, not implemented\n"));
>   }
> LWIP_DEBUGF(LWFTP_SEVERE,("lwftp: tcp state control state %d after control close\r\n",s->control_pcb->state));
> s->control_pcb = NULL;
>   }
>   return err;
> }
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> but will some times test i got a assert :
>
> no segment to free
> Assert failed in file lwip-2.1.2/src/core/tcp_in.c, line 884
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i was so weird what wrong , its my tcp client code has some bugs ? or i use the raw tcp api wrong way ? or there are some bugs in lwip raw tcp API when multi and fast connect and disconnect ?


original submission:

> Hi:
> i wanna implement a FTP client with raw tcp API,and i porting the lwip 2.1.2 release veersion on my FreeRTOS platform ,and then i do a simple code with connect and disconnect test
>
> the code is the code is below:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> err_t ftp_client_test(lwftp_session_t *s)
> {
>   err_t error = ERR_OK;
>   lwftp_results retval = LWFTP_RESULT_OK;
>   ip_addr_t ftp_server_address;
>  
>   IP4_ADDR(&ftp_server_address, 192,168,1,141);
>   s->server_ip.addr = ftp_server_address.addr;
>  
>   // Get sessions pcb
>   s->control_pcb = tcp_new();
>   if (!s->control_pcb)
>   {
>     LWIP_DEBUGF(LWFTP_SERIOUS, ("lwftp:cannot alloc control_pcb (low memory?)\n"));
>     retval = LWFTP_RESULT_ERR_MEMORY;
>   }
>   // Open control session
>   ip_addr_t server_ip;
>   u16_t server_port;
>   server_port = s->server_port;
>   server_ip   = s->server_ip;
>  
>   tcp_arg(s->control_pcb,  s);
>   tcp_err(s->control_pcb,  lwftp_control_err);
>   tcp_recv(s->control_pcb, lwftp_control_recv);
>   tcp_sent(s->control_pcb, lwftp_control_sent);
>   error = tcp_connect(s->control_pcb, &server_ip, server_port, lwftp_control_connected);
>   if ( error == ERR_OK )
>   {
>     retval = LWFTP_RESULT_INPROGRESS;
>   }
>
>   return retval;
> }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i trigger ftp_client_test period is 6s, and when connect success , the  lwftp_control_connected will be called ,code is below
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> static err_t ftp_control_connected(void *arg, struct tcp_pcb *tpcb, err_t err)
> {
>   lwftp_session_t s = (lwftp_session_t)arg;
>    err_t error;
>   if (tpcb)
>   {
>   s->control_pcb_pre = tpcb;
>
>   tcp_arg(tpcb,  NULL);
>   tcp_err(tpcb,  NULL);
>   tcp_recv(tpcb, NULL);
>   tcp_sent(tpcb, NULL);
>   error = tcp_close(tpcb);
>   if ( error != ERR_OK )
>   {
>     LWIP_DEBUGF(LWFTP_SEVERE, ("lwftp:pcb close failure, not implemented\n"));
>   }
> LWIP_DEBUGF(LWFTP_SEVERE,("lwftp: tcp state control state %d after control close\r\n",s->control_pcb->state));
> s->control_pcb = NULL;
>   }
>   return err;
> }
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> but will some times test i got a assert :
>
> no segment to free
> Assert failed in file lwip-2.1.2/src/core/tcp_in.c, line 884
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> i was so weird what wrong , its my tcp client code has some bugs ? or i use the raw tcp api wrong way ? or there are some bugs in lwip raw tcp API when multi and fast connect and disconnect ?

Lucas <lucaslwip1699>
Mon 23 Dec 2019 07:09:05 AM UTC, original submission:  

Hi:
i wanna implement a FTP client with raw tcp API,and i porting the lwip 2.1.2 release veersion on my FreeRTOS platform ,and then i do a simple code with connect and disconnect test

the code is the code is below:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
err_t ftp_client_test(lwftp_session_t *s)
{
  err_t error = ERR_OK;
  lwftp_results retval = LWFTP_RESULT_OK;
  ip_addr_t ftp_server_address;
 
  IP4_ADDR(&ftp_server_address, 192,168,1,141);
  s->server_ip.addr = ftp_server_address.addr;
 
  // Get sessions pcb
  s->control_pcb = tcp_new();
  if (!s->control_pcb)
  {
    LWIP_DEBUGF(LWFTP_SERIOUS, ("lwftp:cannot alloc control_pcb (low memory?)\n"));
    retval = LWFTP_RESULT_ERR_MEMORY;
  }
  // Open control session
  ip_addr_t server_ip;
  u16_t server_port;
  server_port = s->server_port;
  server_ip   = s->server_ip;
 
  tcp_arg(s->control_pcb,  s);
  tcp_err(s->control_pcb,  lwftp_control_err);
  tcp_recv(s->control_pcb, lwftp_control_recv);
  tcp_sent(s->control_pcb, lwftp_control_sent);
  error = tcp_connect(s->control_pcb, &server_ip, server_port, lwftp_control_connected);
  if ( error == ERR_OK )
  {
    retval = LWFTP_RESULT_INPROGRESS;
  }

  return retval;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i trigger ftp_client_test period is 6s, and when connect success , the  lwftp_control_connected will be called ,code is below
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static err_t ftp_control_connected(void *arg, struct tcp_pcb *tpcb, err_t err)
{
  lwftp_session_t s = (lwftp_session_t)arg;
   err_t error;
  if (tpcb)
  {
  s->control_pcb_pre = tpcb;

  tcp_arg(tpcb,  NULL);
  tcp_err(tpcb,  NULL);
  tcp_recv(tpcb, NULL);
  tcp_sent(tpcb, NULL);
  error = tcp_close(tpcb);
  if ( error != ERR_OK )
  {
    LWIP_DEBUGF(LWFTP_SEVERE, ("lwftp:pcb close failure, not implemented\n"));
  }
LWIP_DEBUGF(LWFTP_SEVERE,("lwftp: tcp state control state %d after control close\r\n",s->control_pcb->state));
s->control_pcb = NULL;
  }
  return err;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
but will some times test i got a assert :

no segment to free
Assert failed in file lwip-2.1.2/src/core/tcp_in.c, line 884
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i was so weird what wrong , its my tcp client code has some bugs ? or i use the raw tcp api wrong way ? or there are some bugs in lwip raw tcp API when multi and fast connect and disconnect ?

Lucas <lucaslwip1699>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lucaslwip1699 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code