×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Access point selection panics

    Hi all,

    I'd like to upload some files to a remote server without being asked each time which Access Point I prefer. I read it here how I can set the default access point in Python that ensures that I'm going to be asked about the Access Point only once. The code looks fine and works great in a sample Python app, however, it panics in my - more complex - application. The list of Access Points is shown, but as soon as I select one of them the whole Python run-time (i.e. the Shell) exits with KERN-EXEC 3.

    I found a FN Technical Library article that says that in case of low stack CApSettingsHandler::RunSettingsL() method may result in a similar panic, which is exactly the same class & method that is called by the Python code.

    Now I looked into the source of the Python Shell and found that it had 64k of stack size, which is fairly big. Even though, as I said, my application does lots of things (thus might consume lots of stack), I can't believe that there is no free stack remained.

    Has anyone experienced a similar problem before? How could I solve it? Please note that it's only a suspicion that the panic is caused by the afore-mentioned method.

    Looking forward to any response,

    Tote

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Access point selection panics

    Hi Tote,

    I'm sorry to say I can't help much because I've never experienced this problem, but I can point you to a little information about it.
    In the Python for S60 documentation it says:
    3.6 Limitations of Thread Support

    Python for S60 supports starting native threads via the standard thread module. However, the native
    APIs Python for S60 uses have certain limitations that a Python programmer must be aware of.
    Objects that wrap native resources can typically be used only in the thread they are created in. This is
    because native resources cannot be shared between native threads. Examples:

     Symbian OS STDLIB implementation has some limitations that are re
    ected at OS module support
    (see S60 SDK documentation [4]). For example, STDLIB le descriptors cannot be shared between
    threads, and for that reason, Python le objects cannot either.
     Sockets as implemented in the S60 version of the socket module.

    Warning: Trying to use native objects from the wrong thread can crash the interpreter. If display of
    panic codes is enabled, a typical panic code displayed in this case is "KERN-EXEC 3".
    Again, I'm sorry if this wasn't very helpful, but I've yet to have this problem.

    The best of luck with finding the solution.

  3. #3
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Smile Re: Access point selection panics

    Quote Originally Posted by tote_b5 View Post
    Hi all,

    I'd like to upload some files to a remote server without being asked each time which Access Point I prefer. I read it here how I can set the default access point in Python that ensures that I'm going to be asked about the Access Point only once. The code looks fine and works great in a sample Python app, however, it panics in my - more complex - application. The list of Access Points is shown, but as soon as I select one of them the whole Python run-time (i.e. the Shell) exits with KERN-EXEC 3.
    Hi Tote,

    Code:
    def set_accesspoint():
        apid = socket.select_access_point()
        if appuifw.query(u"Do you want to set this as default access point","query") == True:
            f = open('C:\\data\\wc\\apid.txt','w')
            f.write(repr(apid))
            f.close()
            appuifw.note(u"Saved default access point ", "info")
            apo = socket.access_point(apid)
            socket.set_default_access_point(apo)
    The above code I use for my applications where I would like to have a default access point and upload data to a server continuously without being prompted for an access point. The code works clean for me while uploading stuff for long hours too and I do not face any panics, (The shell doesn't exit when I select the Access point)

    The default access point code saves the selected access point to a text file and every time it refer values from the same file. Thus it may be a problem with the path of the file not set properly if you face the panics, try having the file at other locations, and the file contains a numeric value, say 16,18,20, etc when an access point is selected.

    Best Of Luck

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Access point selection panics

    Quote Originally Posted by tote_b5 View Post
    The code looks fine and works great in a sample Python app, however, it panics
    Hi Töte,

    Enable tracing and see code line by code line what happen inside your own code and inside PyS60 code. Very useful for debugging, I don't use anything else!

    Cheers,

    --jouni looking forward to see what you're doing

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    13

    Re: Access point selection panics

    Hi tote_b5.

    I experienced a similar situation, and I found out that if I called socket functions when sensor module was active, the application crashed like yours.

    I still haven't found what's wrong with that...

  6. #6
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Unhappy Re: Access point selection panics

    Quote Originally Posted by croozeus View Post
    Hi Tote,

    Code:
    def set_accesspoint():
        apid = socket.select_access_point()
        if appuifw.query(u"Do you want to set this as default access point","query") == True:
            f = open('C:\\data\\wc\\apid.txt','w')
            f.write(repr(apid))
            f.close()
            appuifw.note(u"Saved default access point ", "info")
            apo = socket.access_point(apid)
            socket.set_default_access_point(apo)
    I use almost the same above and this does NOT work for me. Anyway, I might follow Jouni's advice and take traceback info (and companion) into use for debugging.

    Tote

  7. #7
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: Access point selection panics

    hi tote_b5
    jouni has mentioned the correct way of debugging. moreover the panic is really shocking i also didnt faced it any time before. if possible can u tell the forum what u were doing or if you dont mind can you show a bit of code.
    witing for feedback

  8. #8
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Re: Access point selection panics

    Okay, I haven't used this feature so far, but now I need it, again. And even though I added a bunch of new things to my stand-alone Python program, this eror still exists and annoys me a lot.

    However, I now know more about PyS60 in general and this problem in particular. For example, I know that it is socket.select_access_point() method that goes wrong (still KERN-EXEC 3). I can see the list of APs, however, the code panics after I select an AP. It's the same which and what kind of AP I select - the code still panics. Even more, it DOES panic even when there is no AP at all! In this special case it shows a dialog ("No access points defined. Define one in Connection Settings.") and then panics.

    As to panics in PyS60, it's really PITA. I cannot debug a panic, since there is no direct support for that not only in PyS60, but in Symbian/C++ itself, either. I cannot turn on some logging, for example, that would reveal me more info about the problem, because such a feature doesn't exist, either.

    What is even more annoying is that it DOES work for you, guys. I tried it on my device in Python Shell and it worked great. It's just my program that is sooo special (don't ask me why - I don't know) that this method cannot cope with.

    I'm now thinking in getting the source code for this method, build a wrapper around it, which is in my control - that means that I can add logs to the code and get a clearer picture on what's going on.

    Cheers,

    Tote

  9. #9
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Re: Access point selection panics

    Quote Originally Posted by tote_b5 View Post
    What is even more annoying is that it DOES work for you, guys. I tried it on my device in Python Shell and it worked great. It's just my program that is sooo special (don't ask me why - I don't know) that this method cannot cope with.
    I've 2 sis-packaged (with Ensymble) programs, the older one (more bloated, makes more things in the __init__()) works well with select_access_point-stuff but the newer one does not, it just goes away just after selecting something from socket.select_access_point(). Both work without problems if started from scriptshell (or from Ped).

    So I added e32.ao_sleep(0.1) just before it to slow down things:

    Code:
        def _select_access_point(self):
            """
            Shortcut to socket.select_access_point() 
            """
            e32.ao_sleep(0.1) # Python crashes if this is not here.
            self.apid = socket.select_access_point()
            if self.apid:
                self.apo = socket.access_point(self.apid)
                socket.set_default_access_point(self.apo)
    Tell me if this works for you too.

  10. #10
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Re: Access point selection panics

    Quote Originally Posted by aaaaapo View Post
    ...
    So I added e32.ao_sleep(0.1) just before it to slow down things:

    Code:
        def _select_access_point(self):
            """
            Shortcut to socket.select_access_point() 
            """
            e32.ao_sleep(0.1) # Python crashes if this is not here.
            self.apid = socket.select_access_point()
            if self.apid:
                self.apo = socket.access_point(self.apid)
                socket.set_default_access_point(self.apo)
    Tell me if this works for you too.
    I'm sorry, but it didn't work for me.

  11. #11
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Thumbs up Re: Access point selection panics

    I've solved it! As I've already written, I had to show the AP selection dialog by myself: I populated a list that served as the model for the list and I showed it. It's a workaround: not too nice, not too long, but it works for me.

    Code:
        import socket, appuifw
        ap_dict = socket.access_points()    # 'iapid' and 'name' in dict
        sel_item = appuifw.selection_list([i['name'] for i in ap_dict])
        if sel_item != None:    # != Cancel
            apo = socket.access_point(ap_dict[sel_item]['iapid'])
            socket.set_default_access_point(apo)
    Tote

  12. #12
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Smile Re: Access point selection panics

    Quote Originally Posted by tote_b5 View Post
    It's a workaround: not too nice, not too long, but it works for me.
    Its good till it works.

    What device and firmware do you try it on?

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  13. #13
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Re: Access point selection panics

    Quote Originally Posted by croozeus View Post
    Its good till it works.
    Yeah, true. I can't see any reason, though, why it wouldn't work on newer releases, too. I didn't do any magic, but mashed up two existing features (i.e. query all APs and show them in a listbox) in order to replace an oddly behaving third one.

    Quote Originally Posted by croozeus View Post
    What device and firmware do you try it on?
    Well, I can't tell you any firmware #s now, because the devices I tried my software on are not with me. Nevertheless, there were an N82 and an N95 8GB that I tried this on and the symptoms were the same on both.

    Cheers,

    Tote

  14. #14
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,801

    Re: Access point selection panics

    Quote Originally Posted by tote_b5 View Post
    Nevertheless, there were an N82 and an N95 8GB that I tried this on and the symptoms were the same on both.
    Its still strange for me as the code I had given works on my N95 atleast and E90 too, I don't have a N82 yet!

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  15. #15
    Regular Contributor
    Join Date
    Feb 2004
    Location
    Budapest, Hungary, Europe
    Posts
    168

    Re: Access point selection panics

    Quote Originally Posted by croozeus View Post
    Its still strange for me as the code I had given works on my N95 atleast and E90 too, I don't have a N82 yet!

    Best Regards,
    Croozeus
    I'm sure it has nothing to do with the model! I tried that code in Python Shell and it worked great. On any device. I "just" didn't take the effort to find out the real cause of the problem. Shame on me!

Similar Threads

  1. Connect to WAP Access Point
    By psousa in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-10-28, 11:56
  2. how to avoid HTTP Access point selection dialog
    By jinishakya in forum Symbian Networking & Messaging (Closed)
    Replies: 12
    Last Post: 2007-06-18, 08:18
  3. Access point selection
    By Svat_ in forum Symbian
    Replies: 1
    Last Post: 2007-04-17, 05:45
  4. Why is client code to CSocketEngine hanging at Access Point dialogue?
    By nawkboy in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2003-03-11, 11:16
  5. Replies: 0
    Last Post: 2003-02-24, 04:00

Posting Permissions

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