Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I've found an issue with SerialDataEventListener... somehow, after 300+ iterations, the listener no longer receives data from serial port, even when serial connection was successfully established
This is my SerialDataEventListener
And this is my service code (runs every X minutes via scheduling)
I only configure DataListener once, and reuse it on every iteration.
The thing is, after 300 iterations or more, DataListener no longer is triggered
This is the log for my first iteration
And this is my output for iteration 345
Note that logging for "Payload received" no longer appears, and values for memory and temperature are the same as the last time they printed correctly (as values from listener do not reset)
Can you guide me to check if my code is using API correctly?
Executed another run last night, and data listener stopped working on iteration 355 .
It seems to always fail on this iteration, could this be a memory issue ? I get no errors on logs, it just stops working
Running time was almost 6 hours
On each sensing cycle I send 4 messages to Arduino and expect 4 responses. This means on each cycle, threadPoolExecutor executes 4 tasks
This is the current status of ThreadPoolExecutor
I have remote debugging enabled on my running app, and "completed tasks" does not increment. 1376 tasks / 4 tasks per cycle = 344 cycles, just as before.
Thread "pi4j-single-executor-0" still appears on Threads window, as WAIT
After testing several combinations and code enhancements, keeping the serial connection open during all program execution seems to solve the problem
I've achieved more than 3.000 iterations without any problems, and data is arriving consistently from remote serial devices.