B4J Question Getting random "Error occured on line xx(Main)"

Gary Miyakawa

Active Member
Licensed User
Longtime User
I'm using a small program to read serial data from a USB/RS232 adapter plugged into a RPI3. It works for a while and then throws a "Error Occurred on line 67" which is the end of the NewData sub.

B4X:
Sub astream_NewData (Buffer() As Byte)
    rcvStr = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    Log("Newdata received: " & rcvStr)
End Sub

There is no other error message in the log. I've tried both 5.0 and 5.5 and the error is the same. Is there anyway to get "verbose" log information ?

Any suggestions is welcome !

Thanks,

Gary Miyakawa
 

Gary Miyakawa

Active Member
Licensed User
Longtime User
It is most probably not related to that thread. You can test it with B4J v5.50.

What is the adapter sending? Are you sure that it is a UTF8 string?


9600, 8, None, 1 (no Flow control).

Yes on the UTF8.

Same failure with released 5.0 and the 5.50 Beta #2

What is odd is that it only fails in Debug AND it's random in that it will run for a while (20 seconds up to couple of minutes) and then throw the "Error" message and stop with nothing else listed in the log file.

Is there another log file I should be monitoring ?

Thanks,

Gary Miyakawa
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
You can enable the IDE logs: https://www.b4x.com/android/forum/posts/50478/

Not sure that it will provide relevant information here.


Looks like its a debug read timeout.

RD: .B4XTypes$B4XClass: main: ka_tick can delegate? true
RD: .B4XTypes$B4XClass: main: astream_newdata can delegate? true
RD e: java.net.SocketTimeoutException: Read timed out
RD e: at java.net.SocketInputStream.socketRead0(Native Method)
RD e: at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
RD e: at java.net.SocketInputStream.read(SocketInputStream.java:170)
RD e: at java.net.SocketInputStream.read(SocketInputStream.java:141)
RD e: at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
RD e: at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
RD e: at anywheresoftware.b4a.shell.ShellConnector.readControlData(ShellConnector.java:191)
RD e: at anywheresoftware.b4a.shell.ShellConnector.connect(ShellConnector.java:186)
RD e: at anywheresoftware.b4a.shell.ShellConnector.run(ShellConnector.java:115)
RD e: at java.lang.Thread.run(Thread.java:745)
RD: connected: false
Stopping RapidDebugger
ExitCode: 0
Output:
Error:
Trying to connect to port: 6907
Trying to connect to port: 6790
Connected!
Gui: 556

Both systems (laptop and RPI3) are on the same Gig Switch so it's almost a direct connection.

Could the Bridge running on RPI be not responding ? Is there a log over there I can view ?

Gary Miyakawa
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
The bridge app is not relevant. It only starts the program.

The error you see is expected. It happens after the real error which caused the program to crash.

Can you post the program logs?

When you say "Program logs" do you mean the logs I created or this c:/temp/log.txt ?
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
The logs shown in the IDE (with "Error Occurred on line 67").

This failure did not show the "Error" message, it just stopped running...

I've included the program (.zip), the copy of the log (clipboard) and the "log.txt" file from c:/temp

Let me know what else you need.

Thank you !

Gary Miyakawa
 

Attachments

  • B4J Failure.txt
    603 bytes · Views: 183
  • B4x debug Fail.zip
    1 KB · Views: 182
  • log.txt
    6.1 KB · Views: 208
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
I will look into it, since they are on a common switch (that I own), that it would be network but I will check it out.

Thank you,

Gary Miyakawa

Folks,

I've done the following changes but still have the same "lockup" failure.

Changed laptops (went from windows 8.1 to Windows 10), Loaded the same B4J 5.5 beta.
Changed Switch from Netgear Plus to a Juniper 12 Port Entrprise switch.
Changed RPI3 (kept the same memory card though. It does have the OS on it).

The failure has not changed other than it is very random of how long it will run before the program just "stops".

I'm open to suggestions since this is slowing down my development by quite a bit.

Gary Miyakawa
 
Upvote 0

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I do not have the answer.

But i may have a partial solution.
Some time ago i had a program that received information of an HTTP server in release mode it was failing randomly and unexpectedly, as i did not know why or how to solve it. i used this:

B4X:
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
'Changed true to false 
    Return False
End Sub

And vuala! even when the error ocurred the app did not stop, it just waited for the next instruccion.
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
I do not have the answer.

But i may have a partial solution.
Some time ago i had a program that received information of an HTTP server in release mode it was failing randomly and unexpectedly, as i did not know why or how to solve it. i used this:

B4X:
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
'Changed true to false
    Return False
End Sub

And vuala! even when the error ocurred the app did not stop, it just waited for the next instruccion.


Thank you for the suggestion but, sadly, no change in the issue.. :( :(
 
Upvote 0
Top