Simon34545 / lginputhook

Allows for remapping remote buttons on LG WebOS TVs.
BSD 3-Clause "New" or "Revised" License
52 stars 2 forks source link

Lg input hook turns off tv #12

Open bkbartk opened 1 year ago

bkbartk commented 1 year ago

All is working well. but since I have installed this app. Sometimes (few times a week)while using the remote the tv gets turned off(or crashes). Also while using buttons which aren’t overwritten. Anyone familiar with this issue? Or is there some log I can see?

Stoppschildgruen commented 1 year ago

I can confirm it. The same thing happens to me.

smx-smx commented 9 months ago

It's caused by multiple threads hitting the PHP code at the same time. PHP-FFI callbacks aren't thread safe, so a hook invoked from multiple threads can bring down the process (simultaneous manipulation of the PHP internal state). This issue is tracked by PHP here https://github.com/php/php-src/issues/9214

The only workaround i can think of is wrapping the native callback in a C trampoline that maintains a lock/mutex before calling the PHP function