Sometimes events are missed when waiting at a semaphore

bug
triggers

#1

I have a piston that subscribes to inactivity events from motion sensor.
Most of the time (let’s say 95%), inactivity event triggers the piston and processing goes as expected.
Sometimes however, something strange happens and I don’t see the event processed at all, despite seeing it logged in the event history of the device. Coincidentally, when this happens, the piston logs the following message: “Piston waited at a semaphore for Xms”

I’ve seen this in several occasion in different code, and not just with motion sensor inactivity events. There are no restrictions filtering anything, just random missing of events.

I believe there’s some sort of bug in the semaphore synchronization logic causing events to be missed.


#2

Your events are coming in too fast. You need to slow them down


#3

Interesting. How can I slow them down?


#4

You could add a “wait” task in between your actions


#5

think that would slow down the piston even further and result in more semaphore waits. :slight_smile:


#6

are you able to post a green snapshot of the piston?


#7

We need to see what you are working with first :wink:


#8

Here it is.