Open th0mas opened 4 years ago
@th0mas thanks for opening this issue to capture. These types of intermittent failures are annoying as they can be difficult to replicate. Keep your eye on them and if you figure out, please share! 👍
Connecting to a hub server seems to fix the timeout issues. Probably means our hub reconnect function hogs too much CPU time which needs more investigating
I think i've made progress on this.
The suspect two lines are:
SmartHomeFirmware.State.subscribe(:test)
SmartHomeFirmware.State.put(:test, :test_val)
This is a race condition as the subscribe
function does some work in an other process, which means we can push to the state before we are subscribed meaning we never receive a state update message.
I'll try adding a Process.timeout(500)
between them
We now get another random fail, where our GPIO library doesn't use its testing stub sometimes.
It should use it whenever MIX_ENV=test
is set.. but sometimes it doesn't
15:09:34.640 [error] Process #PID<0.459.0> raised an exception
** (ArgumentError) argument error
:erlang.load_nif(:erlang, :apply)
(circuits_gpio 0.4.5) lib/gpio/gpio_nif.ex:10: Circuits.GPIO.Nif.load_nif/0
(kernel 7.0) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
Some of the tests for this firmware fail when message passing takes a long time. These messages should be passed instantly (>100ms) and often are but they sometimes timeout and fail.
The problem is, I can't get them to fail consistently, so can't understand the problem