Peter Simpson Expert Licensed User Longtime User Mar 16, 2014 #1 Hello All, Now and again I get a strange error in the HttpUtils2Service (HttpUtils2 version 2.01) at line 40, Response.GetAsynchronously..... Code: Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), True, TaskId) End Sub It just happens now and again once in a blue moon, basically randomly. Does anybody have any ideas on what exactly the issue is apart from where it says (No such file or directory). I personally am not creating any files or folders on the fly. What I'm doing is getting an image(png) from of the internet and inserting it directly into a bitmap. java.io.FileNotFoundException: /data/data/com.simplysoftware.stardate/cache/4: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:409) at java.io.FileOutputStream.<init>(FileOutputStream.java:88) at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370) at com.simplysoftware.stardate.httputils2service._hc_responsesuccess(httputils2service.java:186) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174) at anywheresoftware.b4a.BA$3.run(BA.java:319) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) at libcore.io.IoBridge.open(IoBridge.java:393) ... 16 more It maybe happening happening if JobDone is busy, but I'm not sure to hell you the truth. Cheers... Last edited: Mar 16, 2014
Hello All, Now and again I get a strange error in the HttpUtils2Service (HttpUtils2 version 2.01) at line 40, Response.GetAsynchronously..... Code: Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int) Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), True, TaskId) End Sub It just happens now and again once in a blue moon, basically randomly. Does anybody have any ideas on what exactly the issue is apart from where it says (No such file or directory). I personally am not creating any files or folders on the fly. What I'm doing is getting an image(png) from of the internet and inserting it directly into a bitmap. java.io.FileNotFoundException: /data/data/com.simplysoftware.stardate/cache/4: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:409) at java.io.FileOutputStream.<init>(FileOutputStream.java:88) at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370) at com.simplysoftware.stardate.httputils2service._hc_responsesuccess(httputils2service.java:186) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174) at anywheresoftware.b4a.BA$3.run(BA.java:319) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Posix.open(Native Method) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) at libcore.io.IoBridge.open(IoBridge.java:393) ... 16 more It maybe happening happening if JobDone is busy, but I'm not sure to hell you the truth. Cheers...
Peter Simpson Expert Licensed User Longtime User Mar 16, 2014 #3 Hello @eps , the following is and example of one of many calls. As I said previously, it works a good 9 times out of 10. Please copy and paste the line below into Chrome browser, you will see that it works just fine. http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0009_light_rain_showers.png Thank you Last edited: Mar 17, 2014 Upvote 0
Hello @eps , the following is and example of one of many calls. As I said previously, it works a good 9 times out of 10. Please copy and paste the line below into Chrome browser, you will see that it works just fine. http:\/\/cdn.worldweatheronline.net\/images\/wsymbols01_png_64\/wsymbol_0009_light_rain_showers.png Thank you
stevel05 Expert Licensed User Longtime User Mar 16, 2014 #4 How are you creating the location for TempFolder? My File.DirInternalCache returns /data/data/com.stevel05.test/cache Whereas you have cache/4 (according to the errormesage) Are you creating a new folder in File.DirInternalCache or is that how it is returned? Upvote 0
How are you creating the location for TempFolder? My File.DirInternalCache returns /data/data/com.stevel05.test/cache Whereas you have cache/4 (according to the errormesage) Are you creating a new folder in File.DirInternalCache or is that how it is returned?
Peter Simpson Expert Licensed User Longtime User Mar 16, 2014 #5 Helo @stevel05 , Thank you for the response. I'm not creating the File.DirInternalCache folder or files in that folder. I presume that HttpUtils2 is creating File.DirInternalCache. Upvote 0
Helo @stevel05 , Thank you for the response. I'm not creating the File.DirInternalCache folder or files in that folder. I presume that HttpUtils2 is creating File.DirInternalCache.
stevel05 Expert Licensed User Longtime User Mar 17, 2014 #6 No of course, 4 is the TaskID. Just thinking out loud, The help for File.DirInternalCache states that This data will be deleted automatically when the device runs low on storage Click to expand... Is your device low on storage? Could it be deleting it while the app is running? (I don't know if it will do that) Upvote 0
No of course, 4 is the TaskID. Just thinking out loud, The help for File.DirInternalCache states that This data will be deleted automatically when the device runs low on storage Click to expand... Is your device low on storage? Could it be deleting it while the app is running? (I don't know if it will do that)
Peter Simpson Expert Licensed User Longtime User Mar 17, 2014 #7 stevel05 said: No of course, 4 is the TaskID. Just thinking out loud, The help for File.DirInternalCache states that Is your device low on storage? Could it be deleting it while the app is running? (I don't know if it will do that) Click to expand... Hello @stevel05 , thanks for responding. No it's impossible that the device is low on memory. It's my test Galaxy Nexus, There is nothing on it except for Android 4.3, and maybe 10 or so apps. The G-Nex is not my daily driver. You know your stuff knowing that 4 was the TaskID. I only know that because when I tried debugging it, I spotted the number 4 Upvote 0
stevel05 said: No of course, 4 is the TaskID. Just thinking out loud, The help for File.DirInternalCache states that Is your device low on storage? Could it be deleting it while the app is running? (I don't know if it will do that) Click to expand... Hello @stevel05 , thanks for responding. No it's impossible that the device is low on memory. It's my test Galaxy Nexus, There is nothing on it except for Android 4.3, and maybe 10 or so apps. The G-Nex is not my daily driver. You know your stuff knowing that 4 was the TaskID. I only know that because when I tried debugging it, I spotted the number 4
stevel05 Expert Licensed User Longtime User Mar 17, 2014 #8 There appear to be a few post in the forum about this, without a solution. This seems to be the main one: http://www.b4x.com/android/forum/threads/httputils2-problem.19719/ It's probably worth searching again, just to see if I missed any. Upvote 0
There appear to be a few post in the forum about this, without a solution. This seems to be the main one: http://www.b4x.com/android/forum/threads/httputils2-problem.19719/ It's probably worth searching again, just to see if I missed any.
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2014 #9 This is indeed a strange error. It fails to create a new file. Are you testing it on a real device? Upvote 0
Peter Simpson Expert Licensed User Longtime User Mar 17, 2014 #10 Hello @Erel , yes I'm testing it on an Galaxy Nexus. I'll be testing it on my Nexus 5 today which is my daily driver. Upvote 0
Hello @Erel , yes I'm testing it on an Galaxy Nexus. I'll be testing it on my Nexus 5 today which is my daily driver.
Peter Simpson Expert Licensed User Longtime User Mar 17, 2014 #11 @stevel05 I'll do some more checking, thank you. It just strange that it happens now and again, it works perfectly most of the time. I've disabled that particular feature (swapping to classic icons) in the app and released it. Once I find out what's causing this error, I can release the an update with this feature included. I will check the forum for more information... Upvote 0
@stevel05 I'll do some more checking, thank you. It just strange that it happens now and again, it works perfectly most of the time. I've disabled that particular feature (swapping to classic icons) in the app and released it. Once I find out what's causing this error, I can release the an update with this feature included. I will check the forum for more information...
Erel B4X founder Staff member Licensed User Longtime User Mar 17, 2014 #12 Add this when your program starts and see whether this problem still occurs: Code: File.MakeDir("", File.DirInternalCache) Upvote 0
Add this when your program starts and see whether this problem still occurs: Code: File.MakeDir("", File.DirInternalCache)
Peter Simpson Expert Licensed User Longtime User Mar 17, 2014 #13 I'll give that a go. Thank you master Yoda, erm I mean @Erel Last edited: Mar 18, 2014 Upvote 0
Peter Simpson Expert Licensed User Longtime User Mar 18, 2014 #14 Update: I was still having the same problem, so I decided to download all 38 images(38.5k in total) from the website and save them in the File.DirAssets folder. That way I can bypass the internet connection altogether for retrieving images. I found out that the problem happened more on my 4G(about 22Mb) mobile connection than my 100Mb broadband connection. It also happened even more on my 3.5g(H) connection. Saving the 38 images locally cured the problem 100%, well bypassed the problem anyway. Thanks for all your help guys... Last edited: Mar 18, 2014 Upvote 0
Update: I was still having the same problem, so I decided to download all 38 images(38.5k in total) from the website and save them in the File.DirAssets folder. That way I can bypass the internet connection altogether for retrieving images. I found out that the problem happened more on my 4G(about 22Mb) mobile connection than my 100Mb broadband connection. It also happened even more on my 3.5g(H) connection. Saving the 38 images locally cured the problem 100%, well bypassed the problem anyway. Thanks for all your help guys...