B4J Question Where does /tmp/6 come from?

wimpie3

Well-Known Member
Licensed User
Longtime User
My app crashes with this error:
B4X:
main._appstart (java line: 170)
java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/6 (No such file or directory)
        at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1052)
        at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
        at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
        at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:180)
        at b4j.example.main._appstart(main.java:170)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
        at b4j.example.main.main(main.java:28)
Caused by: java.io.FileNotFoundException: /tmp/6 (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:244)
        at b4j.example.httpjob._getstring2(httpjob.java:252)
        at b4j.example.httpjob._getstring(httpjob.java:241)
        at b4j.example.main$ResumableSub_getNext.resume(main.java:3177)
        at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1050)
        ... 11 more
It seems that the getstring I'm doing on the HttpJob causes a file not found error in a temporary directory? Can anyone explain why this is happening?
 
Solution
I've found the source of the problem. I had this in my code:

B4X:
JobDoc.Download("https://xxxx")
Sleep(7000)
Wait For (JobDoc) JobDone(JobDoc As HttpJob)

This seems to work fine on Windows, but on Linux the temporary file created by the http download is deleted after less than 7 seconds, which results in a file not found error.

wimpie3

Well-Known Member
Licensed User
Longtime User
The weird thing is that it only happens on my Linux machine. The same code runs fine the entire time on Windows!
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
I've found the source of the problem. I had this in my code:

B4X:
JobDoc.Download("https://xxxx")
Sleep(7000)
Wait For (JobDoc) JobDone(JobDoc As HttpJob)

This seems to work fine on Windows, but on Linux the temporary file created by the http download is deleted after less than 7 seconds, which results in a file not found error.
 
Upvote 0
Solution

aeric

Expert
Licensed User
Longtime User
I've found the source of the problem. I had this in my code:

B4X:
JobDoc.Download("https://xxxx")
Sleep(7000)
Wait For (JobDoc) JobDone(JobDoc As HttpJob)

This seems to work fine on Windows, but on Linux the temporary file created by the http download is deleted after less than 7 seconds, which results in a file not found error.
This code is wrong. That's why it creates problem.
 
Upvote 0

Sergio Haurat

Active Member
Licensed User
Longtime User
I have another issue with the Wait For in another project, from what I have learned today, I think this is the problem

B4X:
JobDoc.Download("https://xxxx")
'Sleep(7000)
Wait For (JobDoc) JobDone(JobDoc As HttpJob)

Erel has shared this post with me

 
Upvote 0
Top