×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Application Crashing after Receiving few UDP packets

    Hi,

    I am developing an application which will capture UDP packets send from a server and display it on my screen.

    Socket is correctly created and i do receive some 3 to 4 packets every time and successfully display it on my screen also. Then my app crashes..

    I use RecV() in blocking mode and on successful receiving of message calls back the same function after 1 ms after updating on screen.
    I tried to use the same logic in non-blocking mode too with timer update every 1 ms, but it crashes as soon as it gets first message.

    I tried using RecvFrom() also after i read one post in this forum, but without sucess.

    Can anyone suggest a method to overcome this issue.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Application Crashing after Receiving few UDP packets

    first thing to do would be to check the panic code: http://www.developer.nokia.com/Commu...ded_panic_code , second thing to do would be to find out which code line is giving the panic.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    I got the panic code E32USER-CBASE 46

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Application Crashing after Receiving few UDP packets

    then you could check the out from SDK docs, its basically documented as "This panic is raised by an active scheduler, a CActiveScheduler. It is caused by a stray signal. "

    so as you have it only time to time, just make sure:
    1. You have only one active request active at any time
    - use Cancel() before attempting to start any new request
    - if cancelling is not an option, then check whether there is active request already, before attempting to make one.
    2. Do remember to call SetArtive() right after each time you start active request , and make sure there is no if etc. clauses which could lead to situation where the SetActive() is not called, or is called without setting active request
    3. Always call Cancel() in the active objects destructor

  5. #5
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    My RunL function of timer is giving me the crashing issue..
    But before i call the timer function again using After(), I am making sure that i cancel the timer..

    the function i wrote for monitoring the data is:
    Receive Flow : Blocking mode
    socket.RecvFrom(data,serverAddr,10,status);
    User::WaitForRequest(status);
    Display_on_UI(data);
    iTeState = EReceive;
    iTimer->Cancel();
    iTimer->After(100);

    I will read on SetActive() and try to modify the code accordingly, if that is the case

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,686

    Re: Application Crashing after Receiving few UDP packets

    This particular piece of code is correct in its current form. However synchronous network communication is likely going to kill your UI code on the longer run.
    Is iTimer something derived from CTimer?

  7. #7
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    I am using this code for network communication using UDP..
    My code is getting crashed in this part of code in Timer function -

    void CExampleTimer::RunL()
    {
    iNotify.TimerExpired(this,iStatus.Int());
    }

    iTimer is derived from RTimer.

    If i derive iTimer from CTimer will it resolve the crash??

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Application Crashing after Receiving few UDP packets

    its likely not getting E32USER-CBASE 46 on that line, its likely getting it before it reaches that line. if it really does it after that line, then show what's done in TimerExpired

  9. #9
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    I put a break-point at the end braces and checked.. and Yes it is crashing before it reaches there..
    When I am doing single stepping the code seems to work fine - with no crashes.

    This is what i wrote in timer expiry function
    void CSocket_UDPContainerView::TimerExpired(TAny* aTimer,TInt aError)
    {
    switch (iTeState)
    {
    case EReceive:
    {
    Receive_UDP_Socket();
    }
    break;

    }
    }

    void CSocket_UDPContainerView::Receive_UDP_Socket()
    {
    socket.RecvFrom(data,serverAddr,10,status);
    User::WaitForRequest(status);
    Display_on_UI(data);
    iTeState = EReceive;
    iTimer->Cancel();
    iTimer->After(100);
    }

    So which line is giving me trouble here??

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Application Crashing after Receiving few UDP packets

    likely you have some problems in your timers, After function then. likely the last line called is the iTimer->After(100);, so do check what you do inside it.

    Though have you checked that it leave the function ?
    I can not actually understand why you are using non-automatic variable for the status, when you are using User::WaitForReques(), basically if you use User::WaitForReques() you should use local variable there, and only use class member variable with real Active object usage.

  11. #11
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    Sorry about that. Status is actually local variable only..
    I didn't mention the declaration in the code..

    i'll check the function and see if it is causing issues.. i'll update the same

  12. #12
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    I have checked the function.. It is using standard library function in e32std.inl
    i single stepped the program, it is leaving the function also..

  13. #13
    Registered User
    Join Date
    Jul 2012
    Posts
    43

    Re: Application Crashing after Receiving few UDP packets

    void CExampleTimer::After(TTimeIntervalMicroSeconds32 aInterval)
    {
    Cancel();
    iTimer.After(iStatus,aInterval);
    SetActive();
    }

    I put a breakpoint at SetActive(); every time it hit the breakpoint I resumed the program and found that the app not crashing..
    is it some issue with SetActive() function that app is crashing when calling timer after() function??

  14. #14
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: Application Crashing after Receiving few UDP packets

    the After shown in there is right. so the problem is somewhere else.

    In future, do not modify the codes when copying them in here, otherwise we do not know what you are doing. anyway do check the points I suggested in #4

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,686

    Re: Application Crashing after Receiving few UDP packets

    The stray signal panic practically indicates that you re-use iStatus somewhere, when it is already waiting for something. Check your code from this aspect. One active object can wait for one event at a time.
    Also, if you have multiple usages for a single active object, you will need a variable for tracking what it is waiting for at a given moment. See this recent discussion for a short example: http://www.developer.nokia.com/Commu...ed-the-code!!!

Similar Threads

  1. Replies: 5
    Last Post: 2012-09-04, 08:25
  2. RTP stopped receiving after 100 packets
    By interface_johnson in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2010-10-04, 08:22
  3. Replies: 5
    Last Post: 2010-09-07, 13:35
  4. which socket should i use for receiving packets
    By ahmad_aljallad in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2008-10-23, 04:17
  5. Loss packets when receiving multi-packets data
    By witchsnk in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2008-04-25, 14:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×