lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] LWIP crash


From: Anil kumar
Subject: Re: [lwip-users] LWIP crash
Date: Mon, 10 Sep 2012 17:20:33 +0530

Hi Sylvain/Simon,

I am using Netconn API and  SYS_LIGHTWEIGHT_PROT is also set to 1 in my opt.h file.

I am finding this crash when do_writemore returns ERR_MEM.
According to the code, the transmitting thread waits on the semaphore until it is woken up by the receiver thread. But, in my case the other thread is not able to access the dataptr (the pointer to the data to be trasnmitted).

Please let me know if any one is able to use multi-threaded netconn api in cases where do_writemore returns ERR_MEM.

Thanks,
Anil




Message: 3
Date: Fri, 7 Sep 2012 11:09:47 +0530
From: Anil kumar <address@hidden>
To: address@hidden
Subject: Re: [lwip-users] LWIP crash
Message-ID:
        <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

We are using lwip as a linux kernel module in a multi threaded environment.

Here is the sequence of events that are leading to the crash in my case.

As the application is continuously sending data, do_write continuously
calls do_writemore, which internally calls tcp_write. At some point
tcp_write returns ERR_MEM and do_write waits on semaphore op_completed.

When an ack is received from the other end, tcp_input function calls
sent_tcp which calls do_writemore, if the state of the connection is
NETCONN_WRITE. In do_writemore function access to the data pointer
(dataptr) resulting this crash.

My fix: In sent_tcp function, i am signalling the op_completed semaphore
and from do_write function i am calling do_writemore again, which is
working fine.

 What could be the reason for the crash in the first case,  is it i am
using lwip threads incorrectly ?

 Please let me know if you need any further clarification.

Thanks,
Anil











On Mon, Sep 3, 2012 at 4:32 PM, Anil kumar <address@hidden> wrote:

> Some debugging using prints is indicating that this crash is resulting
> when the available send buffer size reaches zero. The send buffer size in
> my opt.h is 32KB and the packet sizes generated by the application is 128.
>
> The available send buffer reaching zero indicates any leaks ?
>
> Thanks,
> Anil
>
>
>
>
>
> On Fri, Aug 31, 2012 at 5:13 PM, Anil kumar <address@hidden>wrote:
>
>> Hi All,
>>
>> We are using LWIP on linux platform. When we are testing it is crashing
>> repeatedly with the following crash dump.
>> Any help in this regard would be very much helpful.
>>
>>
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495042] *pde = 1bd04067
>> *pte = 00000000
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495110] Modules linked in:
>> lwip(O) ops(O) complib(O) rfcomm bnep bluetooth binfmt_misc i915
>> drm_kms_helper dr
>> m ppdev snd_hda_codec_realtek parport_pc snd_hda_intel snd_hda_codec
>> snd_hwdep i2c_algo_bit video snd_pcm snd_seq_midi snd_rawmidi psmouse
>> serio_raw snd_seq
>> _midi_event snd_seq snd_timer snd_seq_device snd soundcore snd_page_alloc
>> lp parport 8139too 8139cp r8169
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495424]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495439] Pid: 2913, comm:
>> tcpip_input_tim Tainted: G           O 3.2.2 #3                  /DG41RQ
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495504] EIP:
>> 0060:[<c12a1f2d>] EFLAGS: 00010212 CPU: 1
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495541] EIP is at
>> memcpy+0x1d/0x40
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495568] EAX: f947c78a EBX:
>> 00000064 ECX: 00000019 EDX: 0811f550
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495607] ESI: 0811f550 EDI:
>> f947c78a EBP: dbffde18 ESP: dbffde0c
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495644]  DS: 007b ES: 007b
>> FS: 00d8 GS: 00e0 SS: 0068
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495739]  00000064 f947c78a
>> 0811f550 dbffde3c f92ea0fe f92f6db4 f947c78a 0811f550
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495809]  00000064 f947c2d0
>> 00000064 f92fb930 dbffdeb8 f92f21de f92f9303 f947c78a
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495879]  0811f550 00000000
>> 00000056 c1901496 0000de66 00000064 205b0246 32313620
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.495983]  [<f92ea0fe>]
>> lwip_chksum_copy+0x3e/0x60 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92f21de>]
>> tcp_write+0x66e/0x990 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e6f74>]
>> do_writemore+0x164/0x370 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e73c0>] ?
>> poll_tcp+0xb0/0xb0 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e743f>]
>> sent_tcp+0x7f/0xc0 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92eef67>] ?
>> tcp_parseopt.isra.0+0x27/0xe0 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e73c0>] ?
>> poll_tcp+0xb0/0xb0 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92ef5d5>]
>> tcp_input+0x5b5/0xf30 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92eb562>]
>> ip_input+0x2b2/0x2d0 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e959b>]
>> ethernet_input+0x7b/0x330 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c1026288>] ?
>> default_spin_lock_flags+0x8/
0x10
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c156fdbd>] ?
>> _raw_spin_lock_irqsave+0x2d/0x40
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c106ba19>] ?
>> down+0x29/0x40
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e8220>] ?
>> pbuf_free_int+0x10/0x10 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e831c>]
>> tcpip_thread+0xfc/0x160 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<f92e8220>] ?
>> pbuf_free_int+0x10/0x10 [lwip]
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c1065dcd>]
>> kthread+0x6d/0x80
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c1065d60>] ?
>> flush_kthread_worker+0x80/0x80
>> Aug 31 15:52:13 neelima-desktop kernel: [  612.496003]  [<c1576efe>]
>> kernel_thread_helper+0x6/0x10
>> Aug 31 15:52:14 neelima-desktop kernel: [  612.557620] ---[ end trace
>> 333a796a57491d86 ]---
>>
>> Thanks,
>> Anil
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20120907/adea9905/attachment.html>

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

Message: 4
Date: Fri, 7 Sep 2012 10:17:23 +0200
From: Sylvain Rochet <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Subject: Re: [lwip-users] LWIP crash
Message-ID: <address@hidden>
Content-Type: text/plain; charset="iso-8859-1"

Hi Anil,

On Fri, Sep 07, 2012 at 11:09:47AM +0530, Anil kumar wrote:
> We are using lwip as a linux kernel module in a multi threaded environment.
>
> Here is the sequence of events that are leading to the crash in my case.
>
> As the application is continuously sending data, do_write continuously
> calls do_writemore, which internally calls tcp_write. At some point
> tcp_write returns ERR_MEM and do_write waits on semaphore op_completed.
>
> [...]
>
>  What could be the reason for the crash in the first case,  is it i am
> using lwip threads incorrectly ?

It looks like you are using the raw API with threads, raw API is -NOT-
thread safe, you have to use netconn or socket API. Please read
doc/rawapi.txt, but no worry, we all (At least I did) made the mistake
until we find out this file :-)

Also, if you are allocating pbuf outside of the lwIP thread, you have to
set SYS_LIGHTWEIGHT_PROT=1 in your lwipopts.h

Sylvain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.nongnu.org/archive/html/lwip-users/attachments/20120907/d6296121/attachment.pgp>

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

Message: 5
Date: Fri, 07 Sep 2012 10:22:41 +0200
From: "Simon Goldschmidt" <address@hidden>
To: Mailing list for lwIP users <address@hidden>
Subject: Re: [lwip-users] LWIP crash
Message-ID: <address@hidden>
Content-Type: text/plain; charset="utf-8"

Sylvain Rochet wrote:
> > As the application is continuously sending data, do_write continuously
> > calls do_writemore, which internally calls tcp_write. At some point
> > tcp_write returns ERR_MEM and do_write waits on semaphore op_completed.
> >
> > [...]
> >
> >  What could be the reason for the crash in the first case,  is it i am
> > using lwip threads incorrectly ?
>
> It looks like you are using the raw API with threads, raw API is -NOT-
> thread safe, you have to use netconn or socket API.

The functions do_write() and do_writemore are part of the netconn API (the part that runs in tcpip_thread), so I think he's using netconn- or socket API.

Simon


reply via email to

[Prev in Thread] Current Thread [Next in Thread]