[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] BUG: TCP loop forever with tcp_slowtmr
From: |
cpp.china |
Subject: |
[lwip-users] BUG: TCP loop forever with tcp_slowtmr |
Date: |
Mon, 6 Feb 2006 00:08:48 +0800 |
Hello everybody!
I am using lwip 1.1.0 and with the latest patchs from CVS, my system runs
uCos-II(every time tick is 10ms), ARM7(with 256Kbytes SRAM).
If I use wait 100ms every time after lwip_read(1k), lwip will work much
stable. at this condition the lwip can transfer about 90 Mbytes(speed
at 10Kbytes/sec), about worked 8 hours, and pings can get replys.
If I do not wait 100ms every time lwip_read(1k), the sending speed will
raise to 25k bytes/sec (why the speed is so slow?), at this condition
lwip will run into a forever loop processing tcp_slowtmr after transfered
about 1~6M bytes, it seem lwip crashed, and then no ping packet can be
replied, and application blocking in lwip_send.
So I print the tcp_pcb content in tcp_slowtmr, and I found that
when lwip not work, the tcp_pcb->flags will be zero, I had also
tried to increase pcb_remove, but the system will soon crashed after
TCP transfered in serveral seconds.
Here is the output message when lwip go into the forever loop in the
function tcp_slowtmr:
-------------------------------------------------------------------------------
------ PCB (0x15810) -----
pcb->next = 0x0 /* TCP state */
pcb->state = 0x00000004 /* ESTABLISHED */
pcb->prio = 0x00000040
pcb->callback_arg = 0x17110
pcb->local_port = 0x0000270f
pcb->remote_port = 0x00000e2e
pcb->flags = 0x00000000 /* Unknow */
<<<========================= HERE
pcb->rcv_nxt = 0xac7818f1
pcb->rcv_wnd = 0x00002000
pcb->tmr = 0x00000000
pcb->polltmr = 0x00000000
pcb->pollinterval = 0x00000004
pcb->rtime = 0x00000000 /* Retransmission timer. */
pcb->mss = 0x00000400 /* maximum segment size */
pcb->rttest = 0x00000000 /* RTT estimate in 500ms ticks */
pcb->rtseq = 0x00170b6f /* sequence number being timed */
pcb->rto = 0x00000006 /* retransmission time-out */
pcb->nrtx = 0x00000000 /* number of retransmissions */
pcb->lastack = 0x00170b6f /* Highest acknowledged seqno. */
pcb->dupacks = 0x00000000
pcb->cwnd = 0x0000fffc
pcb->ssthresh = 0x00004000
pcb->snd_nxt = 0x00170c6f /* next seqno to be sent */
pcb->snd_max = 0x00170c6f /* Highest seqno sent. */
pcb->snd_wnd = 0x00004000 /* sender window */
pcb->snd_wl1 = 0xac7818f1 /* Sequence and
acknowledgement numbers of last window update. */
pcb->snd_wl2 = 0x00170b6f
pcb->snd_lbb = 0x00170c6f /* Sequence number of next
byte to be buffered. */
pcb->acked = 0x00000200
pcb->snd_buf = 0x00000700 /* Available buffer space for
sending (in bytes). */
pcb->snd_queuelen = 0x00000001 /* Available buffer space for
sending (in tcp_segs). */
pcb->unsent = 0x0 /* Unsent (queued) segments. */
pcb->unacked = 0x16e08 /* Sent but unacknowledged segments. */
pcb->keepalive = 0x006ddd00 /* idle time before KEEPALIVE is sent */
pcb->keep_cnt = 0x00000000 /* KEEPALIVE counter */
-------------------------------------------------------------------------------
Here is part of my application code:
-------------------------------------------------------------------------------
printf("tcp_client recv starting...\n");
while (1) {
len = lwip_read(clientfd, buf, sizeof(buf));
if (len > 0) {
send_try = 0;
resend:
if (send_try > 100) {
printf("*** send failed!\n");
break;
}
if (lwip_write(clientfd, buf, len) <= 0) {
OSTimeDly(1);
send_try++;
goto resend;
}
}
else if (len <= 0) {
kprintf("<----- lwip_read() <= 0\n");
break;
}
// if I comment the below line, lwip will soon crashed in serveral minites
// if I use OSTimeDly(10) every loop, lwip seems more stable.
//OSTimeDly(10); <======================== HERE
}
Here is my lwip config file: lwipopt.h
-------------------------------------------------------------------------------
#define MEM_SIZE (1024 * 64)
#define MEMP_NUM_PBUF 32
#define MEMP_NUM_UDP_PCB 6
#define MEMP_NUM_TCP_PCB 10
#define MEMP_NUM_TCP_PCB_LISTEN 100
#define MEMP_NUM_NETBUF 16
#define MEMP_NUM_NETCONN 16
#define MEMP_NUM_API_MSG 32
#define MEMP_NUM_TCPIP_MSG 128
#define MEMP_NUM_SYS_TIMEOUT 6
#define PBUF_POOL_SIZE 256
#define PBUF_POOL_BUFSIZE 128
#define PBUF_LINK_HLEN 16
#define LWIP_TCP 1
#define TCP_TTL 255
#define TCP_QUEUE_OOSEQ 0
#define TCP_MSS 1024
#define TCP_SND_BUF (1024 * 2)
#define TCP_SND_QUEUELEN (4 * TCP_SND_BUF/TCP_MSS)
#define TCP_WND (1024 * 8)
#define TCP_MAXRTX 12
#define TCP_SYNMAXRTX 4
#define ARP_TABLE_SIZE 10
#define ARP_QUEUEING 0
#define IP_FORWARD 0
#define IP_OPTIONS 1
#define IP_REASSEMBLY 1
#define IP_FRAG 1
#define ICMP_TTL 255
#define LWIP_DHCP 0
#define DHCP_USE_API 0
#define DHCP_DOES_ARP_CHECK 0
#define LWIP_UDP 1
#define UDP_TTL 255
#define SYS_LIGHTWEIGHT_PROT 1
-------------------------------------------------------------------------------
--- E N D ---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] BUG: TCP loop forever with tcp_slowtmr,
cpp.china <=