×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    strange networking bug

    All,

    I have a really strange bug in my code. Been looking at it for a while now and I can't seem to find the problem.

    In short my app contains a MMsvSessionObserver derived class that deals with HandleSessionEventL calls and it contains a class derived from CBase, MHTTPTransactionCallback and MHTTPDataSupplier that I use to do an HTTP post call.

    The problem is as follows. If I do not use the HTTP client class the app works just fine. I receive the session events and I can view and parse the messages as they come in. When I use the HTTP class to do a post request all is fine as well (or even multiple post requests are fine). However, when I do a post request and then let the HTTP client be idle for 20 secs my application dies.

    It always happens after these events (from the emulator debug)

    Code:
    WSOCK: ServProvider: [0D714EB0] 0 bytes in socket, 0 bytes unread
    WSOCK: ServProvider: [0D714EB0] end of data, I guess
    And those events happen exactly 20 seconds after I last did a post request.

    The app dies either immediatly
    Code:
    WSOCK: ServProvider: [0D714EB0] 0 bytes in socket, 0 bytes unread
    WSOCK: ServProvider: [0D714EB0] end of data, I guess
    Thread CMyApp::CMyApp Panic USER 44
    Or it dies as soon as I fire a new message in
    Code:
    WSOCK: ServProvider: [0D714EB0] 0 bytes in socket, 0 bytes unread
    WSOCK: ServProvider: [0D714EB0] end of data, I guess
    WSOCK: ServProvider: [0D714EB0] Shutdown(00000000)
    WSOCK: ServProvider: [0D714EB0] SetNotify(00000000)
    WSOCK: ServProvider: [0D714EB0] destroyed
    MSGRelay -- aiState:1 aiGetErr:0 tiState:0 tiGetErr:-1
    MSGRelay -- setTiErr:-1
    Thread CMyApp::CMyApp Panic E32USER-CBase 21


    The panic codes don't mean much to me either, esp the last one as I don't even use arrays in my code. Any help would be appreciated.

    L

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: strange networking bug

    when you view sdk,
    user 44 panic means This panic is raised by the Free() and FreeZ() member functions of an RHeap. It is caused when the cell being freed overlaps the next cell on the free list (i.e. the first cell on the free list with an address higher than the one being freed).

    it seems you have lost pointer,

    and E32USER-CBase 21 means This panic is raised by any operation which accesses an element of an array by explicit reference to an index number, for example, the Delete(), InsertL() and At() member functions or the operator Operator[]. It is caused by specifying an index value which is either negative or is greater than or equal to the number of objects currently within the array.

    it seems your RArray/RPointerArray outer the array length, like -1 index or index == 3 when array size is 3 etc.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    Between, in the emulator preferences, you can enable "Just In Time Debugging" and it will also show you the exact code where the panic happened, so you can target that line properly
    if you still cannot, then paste that line here and may be some of us could help you ...
    Amit Kankani
    Nokia Developer Champion

  4. #4
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    I know what the panic codes mean. But as I said, I don't even use arrays in my application. The code panics not in the application code (I have put RDebug statements absolutely everywhere, I also stepped through the instructions in the debugger and the code I wrote myself is not in use at the moment of Panic), but somewhere in either the underlying classes or OS level calls.

    The only idea I can come up with is that when the socket connection is idle for 20 secs, one of the classes in the socket library is closing and cleaning up the connection and related objects and is invalidating something which I have instantiated in my code. The only maybe odd thing I do (I am fairly new to Symbian, and with odd I mean different then what most literature/examples do) is that for the HTTP client I actually declare a RSocketServ and RConnection object as part of the class and not as local variables in the method that does the HTTP request. This means they will be instantiated when my HTTP client is created. In the ConstructL method I then call connect in the RSocketServ object and use that to Open() and Start() the RConnection. I did this because I don't want to manually push buttons (i.e select accesspoint etc) each time the app uses the network, instead I do it once at startup. The only idea I have sofar (and because the debug points to the fact that this "WSOCK: ServProvider: [0D714EB0] Shutdown(00000000)" is the point where something bad happens) is that that RSocketServ or RConnection object is invalidated.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    Quote Originally Posted by amitkankani View Post
    Between, in the emulator preferences, you can enable "Just In Time Debugging" and it will also show you the exact code where the panic happened, so you can target that line properly
    if you still cannot, then paste that line here and may be some of us could help you ...
    I just checked, just in time is already ticked. Where does it show the code where the panic happened? (would it show that if it is not my own code?)

  6. #6
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    It would show the debug Stack, and in that stack, look at the first location where you can see your code, that will be the last line where your code would have executed.

    Between, if you are doubtful whether the connection is closing in the background, then you can you RConnection's Notification mechanism to see any close in connection and react accrodingly, see sdk for RConnection and check for "ProgressNotification"
    Amit Kankani
    Nokia Developer Champion

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    I presume you mean the window that shows all the threads etc called "Debug" ?

    When the panic happens one of the threads displays "Suspended: Signal 'Halt' received."

    The last call to my code in that is actually the E32Main(). The last call before the panic is in ekern.exe

  8. #8
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    Well this totally means it is an asynchronous function causing the panic... and will be a little difficult to debug.

    But as you said, 20 seconds later you find the problem, and you also think the connection might be broken...use the connection monitoring, using ProgressNotification of RConnection...

    also another thing, you face this problem on emulator ? or device also ? i would suggest using a device as well...
    Amit Kankani
    Nokia Developer Champion

  9. #9
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    It happens on the phone as well. I also removed the sockerserver & connection objects from my code (so now I have to select a network when I do the call) and the panic still occurs.

    Something in the socket library is cleaning up an object that either it shouldn't or I am not using properly. I just realised that I may have some beta version of the S60 3rd edition SDK, I think I may try and update that.

  10. #10
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    Its better to use 3rd edition MR version (maintainence release).
    Amit Kankani
    Nokia Developer Champion

  11. #11
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    I somehow had 3rd edition FP2-Beta installed ... I am now getting the normal 3rd edition FP1 from this site.

  12. #12
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    Generally if you are not using any specific feature of FP1, I would suggest you to use 3rd edition MR release, as the binaries generated from this will be compatible for all 3rd edition devices...
    Amit Kankani
    Nokia Developer Champion

  13. #13
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    Interesting, although I am working for a very specific (personal) model. The FP1 release is stable isn't it?

  14. #14
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: strange networking bug

    Which phone model, if the phone model is FP1, then the SDK is fine... the SDK itself has no problems though

    Just be sure that your phone model is also 3rd FP1 or higher, and not lower...
    Amit Kankani
    Nokia Developer Champion

  15. #15
    Registered User
    Join Date
    Jan 2008
    Posts
    38

    Re: strange networking bug

    Well I finally solved it. In the end it was of course my code and had nothing to do with networking or messaging.

    The HTTPClient calls a method that returns an HBufC8* .. I deleted this buffer after it was no longer needed. But it escaped me that the method was an LC one (and hence popped it on the cleanup stack).

    That only took me 2 days .. I think the error was so vague because the cleanupstack is probably not used again until this WSOCK call in the socket libraries.

    Thanks for thinking anyway.

    L

Similar Threads

  1. TTime::FormatL() strange bug
    By Czajnikowski in forum Symbian
    Replies: 6
    Last Post: 2009-02-04, 21:16
  2. Very strange bug in opening URLs
    By shrosenzwe in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-10-15, 13:54
  3. 7610 and strange bug with TTime
    By anttiaa in forum Symbian
    Replies: 2
    Last Post: 2004-08-26, 05:46
  4. Strange bug on N3650 with Firmware 4.13
    By NeoEgoism in forum Symbian
    Replies: 1
    Last Post: 2004-05-04, 04:08
  5. Strange bug on N3650 with Firmware 4.13
    By NeoEgoism in forum General Development Questions
    Replies: 0
    Last Post: 2004-05-03, 12:13

Posting Permissions

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