SIGSEGV error with WebClient DownloadFile

mscott161mscott161 USUniversity ✭✭

I have an android app built for API16 debugging on the device itself Samsung SCH-I915. I have a loop that downloads text files and pdf files using the WebClient object. Everytime it stops randomly while downloading. Sometimes it download 12 files other times 15 files. It is the same error
03-15 09:52:19.836 E/mono-rt (20952): at ???+99114 [0x400eb32a]
03-15 09:52:19.836 E/mono-rt (20952): at abort+4 [0x400e0c04]
03-15 09:52:19.836 E/mono-rt (20952): at ???+2099892 [0x5e85eab4]

Answers

  • mscott161mscott161 USUniversity ✭✭

    The total size of all files is 2.1 GB and most files are either 0 bytes to 15MB.

  • mscott161mscott161 USUniversity ✭✭

    The android tablet is a Samsung Note 2 with 3G/4G

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Hi @mscott161 --

    A few questions:

    1) What version of Xamarin.Android are you using? (e.g. channel)
    2) Does this work on the emulator and fail on the device?
    3) Do you get see any exceptions in the output?
    4) What happens if you store on internal storage vs. SDCard?

  • mscott161mscott161 USUniversity ✭✭

    1.) Latest version from Xamarin. set to target KitKat API 16. Minimum API have tryied both honeycomb to kitkat.
    2.) yes, it works on the emulator and fail on the device. (Note the code works on a LG Tablet with Lollipop.
    3.) no exceptions was thrown.
    4.) same crash.

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Given that it works on some devices/environments and not others, I doubt this is directly a Mono related issue.

    I'm going to guess that you are running into some sort of resource restriction on the failing device. Try running it with ADM attached and watch things like the heap - perhaps it's running out of memory too quickly, or it's a single core and your task is taking too long (e.g. single core devices running CPU bound threads on Android have trouble keeping the UI thread responsive and can cause the process to be terminated).

    A couple of suggestions:

    1. Convert to HttpClient and then use ModernHttpClient to get you onto the Android network stack so the OS knows you are doing network I/O - this will free up a thread while it's downloading the file (WebClient is a managed class - no Android involved there).

    2. Look at the difference between the two devices (CPU, memory, SDCard storage, OS version, etc.) since one works and the other does not. See if there's an obvious difference (e.g. one is multicore, one has more memory, etc.) to see if you can isolate what the problem might be caused by.

    3. Try adding some pause time between the file downloads to see if you can give the CPU a rest for example.

    Hopefully that will help identify the issue. If you are still having trouble, perhaps schedule an office hour with an instructor to look at the code together.

    Mark Smith
    Xamarin University | Curriculum

  • mscott161mscott161 USUniversity ✭✭

    Do you have a web site for using the HttpClient with ModernHttpClient. I believe I tryed that before and with the same result.

  • mscott161mscott161 USUniversity ✭✭

    I have modified the app to try using the HttpClient with no luck. Same error on the SIGSEGV. Which instructor should I use to setup an office hour?

Sign In or Register to comment.