codeaudit / funf-open-sensing-framework

Automatically exported from code.google.com/p/funf-open-sensing-framework
0 stars 0 forks source link

Data Upload fails on older devices #79

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using HTC wildfire Android version 2.2.1
2. Creat tutorial wifi scanner app and create an upload now button to upload 
your data on button press, also add some other sensors to app
3. Do not allow phone to upload for a while and then attemptupload

What is the expected output? What do you see instead?
Expected: Upload to server completes
Actual: first one or two files upload then app crashes with out of memory error 
referencing line 179 in file httparchive.

What version of the product are you using? On what operating system?
Android 2.2.1

Please provide any additional information below.
Suggested fix: add 
            conn.setChunkedStreamingMode(0);
after line 161 same file, this will make sure the outgoing request doesn't 
buffer the entire file in memory leading to potential crash (or crash in my 
case)

Original issue reported on code.google.com by Finn.Kre...@gmail.com on 30 Jan 2012 at 4:26

GoogleCodeExporter commented 9 years ago
We are experiencing the same problems. I will try the fix suggested by the 
original poster.

Here's a stack trace of the crash:

04-24 02:24:19.151: ERROR/AndroidRuntime(996): FATAL EXCEPTION: Thread-1901
04-24 02:24:19.151: ERROR/AndroidRuntime(996): java.lang.OutOfMemoryError
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
libcore.net.http.RetryableOutputStream.write(RetryableOutputStream.java:61)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
java.io.DataOutputStream.write(DataOutputStream.java:98)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
edu.mit.media.funf.storage.HttpArchive.uploadFile(HttpArchive.java:179)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
edu.mit.media.funf.storage.HttpArchive.add(HttpArchive.java:92)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
edu.mit.media.funf.storage.UploadService.runArchive(UploadService.java:157)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
edu.mit.media.funf.storage.UploadService$1.run(UploadService.java:83)
04-24 02:24:19.151: ERROR/AndroidRuntime(996):     at 
java.lang.Thread.run(Thread.java:856)

Original comment by mar...@wustenberg.dk on 25 Apr 2012 at 12:34